@ml2drender/wasm
    Preparing search index...

    Interface ProjectedRenderer

    A MapRenderer drawing in a CRS (see MapRenderer.projected).

    interface ProjectedRenderer {
        crs: Crs;
        render(box: ProjectedBox): Promise<RenderedImage>;
        renderTile(tile: Tile): Promise<RenderedImage>;
        renderView(view: View): Promise<RenderedImage>;
        getTile(tile: SourceTile): Promise<Uint8Array<ArrayBuffer>>;
        toStyle(options: { tiles: (source: string) => string }): StyleSpecification;
    }
    Index
    crs: Crs

    The CRS given to MapRenderer.projected.

    • render of MapLibre GL JS's camera in the CRS (registered with addProjection): center in degrees, a tile of the grid's first level (tile 0/0/0 of GL JS's) 512 CSS pixels wide at zoom 0, turned around center by bearing.

      Parameters

      Returns Promise<RenderedImage>

    • Fetch the data of tile.source and return it in tile z/x/y of the CRS's grid, for MapLibre GL JS to draw the style in the CRS from (see toStyle), not a picture of the map:

      • vector / GeoJSON: a vector tile (MVT, extent 4096). Layers, features and properties are kept as they are (a GeoJSON source's layer is named after the source).
      • raster / image: a 512 px PNG of the source as a raster layer with default paint draws it.
      • raster-dem: a 512 px PNG of its elevations in the terrarium encoding.

      Source data is fetched at the zoom of the tile drawn at 512 CSS pixels.

      Parameters

      Returns Promise<Uint8Array<ArrayBuffer>>

    • The style for MapLibre GL JS to draw in the CRS (registered with addProjection as crs.name) from tiles of getTile, whose URL templates ({z}/{x}/{y} of the CRS's grid) tiles gives for each source: vector and GeoJSON sources become vector sources (layers of a GeoJSON source read the layer named after it), raster and image sources raster sources, raster-dem sources terrarium ones, all of 512 px tiles. Layers of other sources (video) are left out. The style is the one given to init.

      Parameters

      • options: { tiles: (source: string) => string }

      Returns StyleSpecification