UNPKG

gis-tools-ts

Version:

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

112 lines 4.58 kB
import type { Compression } from '../index.js'; import type { Face, Metadata } from 's2-tilejson'; export * from './json/index.js'; export * from './pmtiles/index.js'; export * from './s2tiles/index.js'; export * from './tiles/index.js'; /** The defacto interface for all writers. */ export interface Writer { write(data: Uint8Array, offset: number): Promise<void>; slice(start: number, end: number): Promise<Uint8Array>; append(data: Uint8Array): Promise<void>; appendSync(data: Uint8Array): void; appendString(string: string): Promise<void>; appendStringSync(string: string): void; } /** A base interface for all tile stores. */ export interface TileWriter { writeTileWM(zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; writeTileS2(face: Face, zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; commit(metadata: Metadata, tileCompression?: Compression): Promise<void>; } /** A base interface for all tile stores. */ export interface TemporalTileWriter extends TileWriter { writeTemporalTileWM(time: Date, zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; writeTemporalTileS2(time: Date, face: number, zoom: number, x: number, y: number, data: Uint8Array): Promise<void>; } /** A Tile writer designed for testing. */ export declare class BufferTileWriter implements TemporalTileWriter { metadata: Metadata | null; tiles: Map<string, Uint8Array>; /** * 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: Face, 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>; } /** Buffer writer is used on smaller datasets that are easy to write in memory. Faster then the Filesystem */ export declare class BufferWriter implements Writer { #private; /** * Append data to the buffer * @param data - the data to append */ append(data: Uint8Array): Promise<void>; /** * Append string to the buffer * @param string - the string to append */ appendString(string: string): Promise<void>; /** * Append data to the buffer synchronously * @param data - the data to append */ appendSync(data: Uint8Array): void; /** * Append string to the buffer synchronously * @param string - the string to append */ appendStringSync(string: string): void; /** * Write data to the buffer * @param data - the data to write * @param offset - where in the buffer to start */ write(data: Uint8Array, offset: number): Promise<void>; /** * Slice the buffer * @param start - the start of the slice * @param end - the end of the slice * @returns - the sliced buffer */ slice(start: number, end: number): Promise<Uint8Array>; /** @returns - the buffer */ commit(): Uint8Array; } //# sourceMappingURL=index.d.ts.map