import type { ElevationConverter, Face, FeatureIterator, MValue, Properties, RGBA, S2Feature, S2PMTilesReader, S2TileID, S2TilesReader, TileID, VectorFeature, WMTileID } from '../../index.js'; import type { Metadata } from 's2-tilejson'; /** Elevation point used by elevation readers */ export interface ElevationPoint extends Properties { elev: number; } /** Tile Reader Interface */ export interface TileReader, D extends MValue = Properties, P extends Properties = Properties> extends FeatureIterator { getMetadata: () => Promise; hasTileWM: (zoom: number, x: number, y: number) => Promise; hasTileS2: (face: Face, zoom: number, x: number, y: number) => Promise; getTileWM: (zoom: number, x: number, y: number) => Promise | undefined>; getTileS2: (face: Face, zoom: number, x: number, y: number) => Promise | undefined>; getLonLatValuesWM: (zoom: number, lon: number, lat: number, tileSize?: number) => Promise; getLonLatValuesS2: (zoom: number, lon: number, lat: number, tileSize?: number) => Promise; iterate(): AsyncGenerator; } /** * # Raster Tiles 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. * * NOTE: Consider using the `RasterTilesFileReader` from `gis-tools-ts/file` instead for local access. * * ## Usage * ```ts * 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); * } * ``` * * ## Links * - https://satakagi.github.io/mapsForWebWS2020-docs/QuadTreeCompositeTilingAndVectorTileStandard.html * - https://cesium.com/blog/2015/04/07/quadtree-cheatseet/ */ export declare class RasterTilesReader implements FeatureIterator, TileReader { readonly input: string | S2PMTilesReader | S2TilesReader; readonly threshold: number; readonly converter?: ElevationConverter | undefined; metadata?: Metadata; /** * @param input - the URL path, S2PMTilesReader, or S2TilesReader 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 | S2TilesReader, threshold?: number, converter?: ElevationConverter | undefined); /** * Get the metadata of the archive * @returns - the metadata */ getMetadata(): Promise; /** * 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 | undefined>; /** * 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 * @param zoom - the zoom level of the tile * @param x - the x coordinate of the tile * @param y - the y coordinate of the tile * @param padding - the amount of padding to add to each side of the tile * @param size - the size of each tile width and height. * @param wantedSize - 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 - the tile */ getTileWithPaddingWM(zoom: number, x: number, y: number, padding: number, size?: number, wantedSize?: number): Promise | 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 | 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; /** * 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; /** * 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; /** * 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; /** * Iterate over all the tiles in the tileset and yield their positions * @returns - an iterator over all the tiles in the tileset * @yields - the metadata of each tile */ iterate(): AsyncGenerator; /** * Iterate over all tiles in the archive * @yields {S2Feature | VectorFeature} * 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 | VectorFeature>; } /** WM Raster Tile Reader */ export declare class RasterTileReader implements FeatureIterator { readonly zoom: number; readonly x: number; readonly y: number; readonly image: ImageData; readonly tmsStyle: boolean; readonly converter?: ElevationConverter | undefined; /** * @param zoom - the zoom level of the tile * @param x - the x coordinate of the tile * @param y - the y coordinate of the tile * @param image - the raw RGB(A) image data * @param tmsStyle - if true, the y is inverted * @param converter - the elevation converter (if provided its not an RGBA image but rather elevation data) */ constructor(zoom: number, x: number, y: number, image: ImageData, tmsStyle?: boolean, converter?: ElevationConverter | undefined); /** * Iterate over all tiles in the archive * @yields {VectorFeature} the each of the tile's pixel RGBA data as lon-lat * coordinates with the RGBA as m-values */ [Symbol.asyncIterator](): AsyncGenerator>; } /** S2 Raster Tile Reader */ export declare class RasterS2TileReader implements FeatureIterator { readonly face: Face; readonly zoom: number; readonly x: number; readonly y: number; readonly image: ImageData; readonly converter?: ElevationConverter | undefined; /** * @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 * @param image - the raw image RGB(A) data * @param converter - the elevation converter (if provided its not an RGBA image but rather elevation data) */ constructor(face: Face, zoom: number, x: number, y: number, image: ImageData, converter?: ElevationConverter | undefined); /** * Iterate over all tiles in the archive * @yields {S2Feature} The each of the tile's pixel RGBA data as S2 s-t * coordinates with the RGBA as m-values */ [Symbol.asyncIterator](): AsyncGenerator>; } //# sourceMappingURL=reader.d.ts.map