gis-tools-ts - v0.8.0
    Preparing search index...

    Class RasterTilesReader<T>

    Raster Tiles Reader

    Read an entire archive of raster tiles, where the max zoom data is iterated upon

    Supports reading either RGB(A) data and/or RGB(A) encoded elevation data.

    NOTE: Consider using the RasterTilesFileReader from gis-tools-ts/file instead for local access.

    import { RasterTilesReader, convertTerrariumElevationData } from 'gis-tools-ts';

    // creates a reader for a tile set treating the max zoom as 3 instead of the metadata's max zoom
    const reader = new RasterTilesReader('https://example.com/satellite-data', 3);
    // example of reading in an elevation dataset
    const reader2 = new RasterTilesReader('https://example.com/terrariumData', -1, convertTerrariumElevationData);

    // grab the metadata
    const metadata = await reader.getMetadata();

    // grab a WM tile
    const tile1 = await reader.getTile(0, 0, 0);
    // or if it's an S2 tile spec
    const tile2 = await reader.getTileS2(0, 0, 0, 0);

    // get a specfic WM value given a longitude and latitude
    const value = await reader.getLonLatValuesWM(0, 0, 0);
    // get a specfic S2 value given a longitude and latitude
    const value2 = await reader.getLonLatValuesS2(0, 0, 0);

    // grab all the max zoom tiles:
    for await (const tile of reader) {
    console.log(tile);
    }

    Type Parameters

    Implements

    Index
    converter?: ElevationConverter

    the elevation converter

    input: string | S2PMTilesReader | S2TilesReader

    the URL path, S2PMTilesReader, or S2TilesReader to read from

    threshold: number = -1

    if non-zero its the max zoom to read all tiles in the FeatureIterator

    • Iterate over all tiles in the archive

      Returns AsyncGenerator<
          | S2Feature<S2TileID, T, Properties, VectorGeometry<T>>
          | VectorFeature<WMTileID, T, Properties>,
      >

      the each of the tile's pixel RGBA data as lon-lat or S2 s-t coordinates with the RGBA as m-values

    • Get the value of the given longitude and latitude

      Parameters

      • zoom: number

        the zoom level

      • lon: number

        the longitude

      • lat: number

        the latitude

      • tileSize: number = 512

        in pixels

      Returns Promise<RGBA | ElevationPoint | undefined>

      • the value at the given longitude and latitude
    • Get the value of the given longitude and latitude

      Parameters

      • zoom: number

        the zoom level

      • lon: number

        the longitude

      • lat: number

        the latitude

      • tileSize: number = 512

        in pixels

      Returns Promise<RGBA | ElevationPoint | undefined>

      • the value at the given longitude and latitude
    • Get the metadata of the archive

      Returns Promise<Metadata>

      • the metadata
    • Grab the tile at the given (face, zoom, x, y) coordinates

      Parameters

      • face: Face

        the Open S2 projection face

      • zoom: number

        the zoom level of the tile

      • x: number

        the x coordinate of the tile

      • y: number

        the y coordinate of the tile

      Returns Promise<RasterS2TileReader<T, T> | undefined>

      • the tile
    • Grab the tile at the given zoom-x-y coordinates.

      This function adds the ability to pull from surrounding images and add them as padding

      This function is also useful for just expanding the zoom level up. So if the image is 256x256, you can use this function to get a 512x512 image

      Parameters

      • zoom: number

        the zoom level of the tile

      • x: number

        the x coordinate of the tile

      • y: number

        the y coordinate of the tile

      • padding: number

        the amount of padding to add to each side of the tile

      • size: number = 512

        the size of each tile width and height.

      • wantedSize: number = size

        the size of the rendered center tile. For example if you want a 512x512 tile, but the source is 256x256, you can set this to 512.

      Returns Promise<RasterTileReader<T, T> | undefined>

      • the tile
    • Grab the tile at the given zoom-x-y coordinates

      Parameters

      • zoom: number

        the zoom level of the tile

      • x: number

        the x coordinate of the tile

      • y: number

        the y coordinate of the tile

      Returns Promise<RasterTileReader<T, T> | undefined>

      • the tile
    • Return true if the tile exists

      Parameters

      • face: Face

        the Open S2 projection face

      • zoom: number

        the zoom level of the tile

      • x: number

        the x coordinate of the tile

      • y: number

        the y coordinate of the tile

      Returns Promise<boolean>

      • true if the tile exists
    • Return true if the tile exists

      Parameters

      • zoom: number

        the zoom level of the tile

      • x: number

        the x coordinate of the tile

      • y: number

        the y coordinate of the tile

      Returns Promise<boolean>

      • true if the tile exists
    • Iterate over all the tiles in the tileset and yield their positions

      Returns AsyncGenerator<TileID>

      • an iterator over all the tiles in the tileset
      • the metadata of each tile