UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

83 lines 3.17 kB
import type { Metadata } from 's2-tilejson'; import type { TemporalTileWriter } from '.'; /** * # Tile File Writer * * ## Description * This is a filesystem Tile writer that organizes data via folders. * * ## Usage * * ```ts * import { FileTileWriter } from 'gis-tools-ts/file'; * * const tileWriter = new FileTileWriter('./store', 'png'); * * // store WM tiles * await tileWriter.writeTileWM(0, 0, 0, data); * // store S2 tiles * await tileWriter.writeTileS2(0, 0, 0, 0, data); * // store temportal WM tiles * await tileWriter.writeTemporalTileWM(new Date(), 0, 0, 0, data); * // store temportal S2 tiles * await tileWriter.writeTemporalTileS2(new Date(), 0, 0, 0, 0, data); * * // after writing all the tiles, store the metadata * await tileWriter.commit(metadata); * ``` * * ## Links * - https://satakagi.github.io/mapsForWebWS2020-docs/QuadTreeCompositeTilingAndVectorTileStandard.html * - https://cesium.com/blog/2015/04/07/quadtree-cheatseet/ */ export declare class FileTileWriter implements TemporalTileWriter { readonly path: string; readonly fileType: string; /** * @param path - the location to write the data * @param fileType - the file ending to write */ constructor(path: string, fileType?: string); /** * Write a tile to the folder location given its (z, x, y) coordinates. * @param zoom - the zoom level * @param x - the tile X coordinate * @param y - the tile Y coordinate * @param data - the tile data to store */ writeTileWM(zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; /** * Write a tile to the folder location given its (face, zoom, x, y) coordinates. * @param face - the Open S2 projection face * @param zoom - the zoom level * @param x - the tile X coordinate * @param y - the tile Y coordinate * @param data - the tile data to store */ writeTileS2(face: number, zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; /** * Write a time series tile to the folder location given its (t, z, x, y) coordinates. * @param time - the date of the data * @param zoom - the zoom level * @param x - the tile X coordinate * @param y - the tile Y coordinate * @param data - the tile data to store */ writeTemporalTileWM(time: Date, zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; /** * Write a time series tile to the folder location given its (face, zoom, x, y) coordinates. * @param time - the date of the data * @param face - the Open S2 projection face * @param zoom - the zoom level * @param x - the tile X coordinate * @param y - the tile Y coordinate * @param data - the tile data to store */ writeTemporalTileS2(time: Date, face: number, zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; /** * Finish writing by building the header with root and leaf directories. * @param metadata - the metadata about all the tiles to store */ commit(metadata: Metadata): Promise<void>; } //# sourceMappingURL=tile.d.ts.map