import type { Face, JSONCollection, Projection, VectorFeatures, VectorPoint } from '../geometry'; /** * # Tile Class * * ## Description * Tile Class to contain the tile information for splitting or simplifying * * ## Fields * * - `extent` - the extent of the tile * - `face` - the tile's face * - `zoom` - the tile's zoom * - `i` - the tile's x position * - `j` - the tile's y position * - `layers` - the tile's layers * - `transformed` - whether the tile feature geometry has been transformed to tile coordinates * * ## Usage * * ```ts * import { Tile } from 's2-tools'; * // create a tile * const tile = new Tile(id); * // add a feature * tile.addFeature(feature); * // transform the geometry to be relative to the tile * tile.transform(); */ export declare class Tile { layers: Record; transformed: boolean; extent: number; face: Face; zoom: number; i: number; j: number; /** * @param id - the tile id * @param layers - the tile's layers * @param transformed - whether the tile feature geometry has been transformed to tile coordinates */ constructor(id: bigint, layers?: Record, transformed?: boolean); /** @returns true if the tile is empty of features */ isEmpty(): boolean; /** * Add a vector feature to the tile, optionally to a specific layer to store it in. Defaults to "default". * @param feature - Vector Feature * @param layer - layer to store the feature to */ addFeature(feature: VectorFeatures, layer?: string): void; /** * Simplify the geometry to have a tolerance which will be relative to the tile's zoom level. * NOTE: This should be called after the tile has been split into children if that functionality * is needed. * @param tolerance - tolerance * @param maxzoom - max zoom at which to simplify */ transform(tolerance: number, maxzoom?: number): void; } /** * Mutates the point in place to a tile coordinate * @param vp - input vector point that we are mutating in place * @param zoom - current zoom * @param ti - x translation * @param tj - y translation */ export declare function transformPoint(vp: VectorPoint, zoom: number, ti: number, tj: number): void; /** Layer Class to contain the layer information for splitting or simplifying */ export declare class Layer { name: string; features: VectorFeatures[]; extent: number; /** * @param name - the layer name * @param features - the layer's features */ constructor(name: string, features?: VectorFeatures[]); } /** Options for creating a TileStore */ export interface TileStoreOptions { /** manually set the projection, otherwise it defaults to whatever the data type is */ projection?: Projection; /** min zoom to generate data on */ minzoom?: number; /** max zoom level to cluster the points on */ maxzoom?: number; /** max zoom to index data on construction */ indexMaxzoom?: number; /** simplification tolerance (higher means simpler) */ tolerance?: number; /** tile buffer on each side so lines and polygons don't get clipped */ buffer?: number; /** whether to build the bounding box for each tile feature */ buildBBox?: boolean; } /** * # Tile Store * * ## Description * TileStore Class is a tile-lookup system that splits and simplifies as needed for each tile request * * ## Usage * ```ts * const tileStore = new TileStore(data, { * projection: 'WM', * minzoom: 0, * maxzoom: 9, * indexMaxzoom: 4, * tolerance: 3, * buffer: 0.0625 * buildBBox: false * }); * * // get a tile * const tile = tileStore.getTile(id); * ``` */ export declare class TileStore { #private; minzoom: number; maxzoom: number; faces: Set; indexMaxzoom: number; tolerance: number; buffer: number; tiles: Map; projection: Projection; buildBBox: boolean; /** * @param data - input data may be WM or S2 as a Feature or a Collection of Features * @param options - options to define how to store the data */ constructor(data: JSONCollection, options?: TileStoreOptions); /** * @param id - the tile id to acquire * @returns - the tile if it exists */ getTile(id: bigint): undefined | Tile; } //# sourceMappingURL=tile.d.ts.map