gis-tools-ts
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
121 lines • 5.31 kB
TypeScript
import { RasterS2TileReader, RasterTileReader } from '../../index.js';
import type { ElevationConverter, ElevationPoint, S2TileMetadata, TileMetadata, TileReader } from './index.js';
import type { Face, FeatureIterator, MValue, Properties, RGBA, S2Feature, S2PMTilesReader, VectorFeature } from '../../index.js';
import type { Metadata } from 's2-tilejson';
/**
* # Raster Tiles File Reader
*
* ## Description
* 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.
*
* ## Usage
* ```ts
* import { convertTerrariumElevationData } from 'gis-tools-ts';
* import { RasterTilesFileReader } from 'gis-tools-ts/file';
*
* // creates a reader for a tile set treating the max zoom as 3 instead of the metadata's max zoom
* const reader = new RasterTilesFileReader('./raster-tiles-top-level-folder', 3);
* // example of reading in an elevation dataset
* const reader2 = new RasterTilesFileReader('./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);
* }
* ```
*
* ## Links
* - https://satakagi.github.io/mapsForWebWS2020-docs/QuadTreeCompositeTilingAndVectorTileStandard.html
* - https://cesium.com/blog/2015/04/07/quadtree-cheatseet/
*/
export declare class RasterTilesFileReader<T extends MValue = RGBA | ElevationPoint, P extends Properties = T> implements FeatureIterator<S2TileMetadata | TileMetadata, T, P>, TileReader<S2TileMetadata | TileMetadata, T, P> {
readonly input: string | S2PMTilesReader;
readonly threshold: number;
readonly converter?: ElevationConverter | undefined;
metadata?: Metadata;
/**
* @param input - the file path or S2PMTilesReader to read from
* @param threshold - if non-zero its the max zoom to read all tiles in the FeatureIterator
* @param converter - the elevation converter
*/
constructor(input: string | S2PMTilesReader, threshold?: number, converter?: ElevationConverter | undefined);
/**
* Get the metadata of the archive
* @returns - the metadata
*/
getMetadata(): Promise<Metadata>;
/**
* Grab the tile at the given zoom-x-y coordinates
* @param zoom - the zoom level of the tile
* @param x - the x coordinate of the tile
* @param y - the y coordinate of the tile
* @returns - the tile
*/
getTileWM(zoom: number, x: number, y: number): Promise<RasterTileReader<T, P> | undefined>;
/**
* Grab the tile at the given (face, zoom, x, y) coordinates
* @param face - the Open S2 projection face
* @param zoom - the zoom level of the tile
* @param x - the x coordinate of the tile
* @param y - the y coordinate of the tile
* @returns - the tile
*/
getTileS2(face: Face, zoom: number, x: number, y: number): Promise<RasterS2TileReader<T, P> | undefined>;
/**
* Return true if the tile exists
* @param zoom - the zoom level of the tile
* @param x - the x coordinate of the tile
* @param y - the y coordinate of the tile
* @returns - true if the tile exists
*/
hasTileWM(zoom: number, x: number, y: number): Promise<boolean>;
/**
* Return true if the tile exists
* @param face - the Open S2 projection face
* @param zoom - the zoom level of the tile
* @param x - the x coordinate of the tile
* @param y - the y coordinate of the tile
* @returns - true if the tile exists
*/
hasTileS2(face: Face, zoom: number, x: number, y: number): Promise<boolean>;
/**
* Get the value of the given longitude and latitude
* @param zoom - the zoom level
* @param lon - the longitude
* @param lat - the latitude
* @param tileSize - in pixels
* @returns - the value at the given longitude and latitude
*/
getLonLatValuesWM(zoom: number, lon: number, lat: number, tileSize?: number): Promise<RGBA | ElevationPoint | undefined>;
/**
* Get the value of the given longitude and latitude
* @param zoom - the zoom level
* @param lon - the longitude
* @param lat - the latitude
* @param tileSize - in pixels
* @returns - the value at the given longitude and latitude
*/
getLonLatValuesS2(zoom: number, lon: number, lat: number, tileSize?: number): Promise<RGBA | ElevationPoint | undefined>;
/**
* Iterate over all tiles in the archive
* @yields {S2Feature<S2TileMetadata, T, P> | VectorFeature<TileMetadata, T, P>} the each of the
* tile's pixel RGBA data as lon-lat or S2 s-t coordinates with the RGBA as m-values
*/
[Symbol.asyncIterator](): AsyncGenerator<S2Feature<S2TileMetadata, T, P> | VectorFeature<TileMetadata, T, P>>;
}
//# sourceMappingURL=file.d.ts.map