UNPKG

open-vector-tile

Version:

This library reads/writes Open Vector Tiles

64 lines 2.6 kB
import MapboxVectorLayer from '../mapbox/vectorLayer.js'; import type { BaseVectorFeature } from './vectorFeature.js'; import type { Extents } from '../open/index.js'; import type { S2JSONLayer } from '../vectorTile.spec.js'; import type { Shape } from '../open/shape.js'; /** * Base Vector Layer * This is an intermediary for storing layer data in the Open Vector Tile format. */ export declare class BaseVectorLayer { #private; version: number; name: string; extent: Extents; features: BaseVectorFeature[]; mShape?: Shape | undefined; shape: Shape; /** * @param version - the version of the vector tile. This is a number that tracks the OVT specification. and shouldn't be tampered with * @param name - the name of the layer * @param extent - the extent of the vector tile (only **512**, **1_024**, **2_048**, **4_096**, and **8_192** are supported) * @param features - the **Base Vector Feature**s stored in the layer. * @param shape - the shape of each feature properies * @param mShape - the shape of each feature's M-Values */ constructor(version?: number, name?: string, extent?: Extents, features?: BaseVectorFeature[], shape?: Shape, mShape?: Shape | undefined); /** * Add a new feature to the layer * @param feature - the new feature to add */ addFeature(feature: BaseVectorFeature): void; /** * @param i - index of the feature to return * @returns A base vector feature at the given index */ feature(i: number): BaseVectorFeature; /** * @returns The number of features in the layer */ get length(): number; /** * @param layer - a Mapbox Vector Layer * @returns A Base Vector Layer */ static fromMapboxVectorLayer(layer: MapboxVectorLayer): BaseVectorLayer; /** * @param layer - a S2JSON Layer * @param layerMap - the layer guide on what extent and shapes to use if user provided * @returns A Base Vector Layer */ static fromS2JSONLayer(layer: S2JSONLayer, layerMap?: S2JSONLayerGuide): BaseVectorLayer; } /** object containing a layer guide for extent, shape, and mShape */ export interface S2JSONLayerGuide { /** The extent to encode the feature geometry to */ extent?: Extents; /** The shape to encode the feature properties to */ shape?: Shape; /** The shape to encode the feature M-Values to */ mShape?: Shape; } /** object containing the layer, extent, and shape */ export type S2JSONLayerMap = Record<string, S2JSONLayerGuide>; //# sourceMappingURL=vectorLayer.d.ts.map