open-vector-tile
Version:
This library reads/writes Open Vector Tiles
77 lines • 3.17 kB
TypeScript
import type { PbfReader } from 'pbf-ts';
import type { BBox, BBox3D, VectorGeometryType } from 's2json-spec';
import type { OldVectorFeatureType, Properties, Value, VectorGeometry, VectorLinesWithOffset, VectorPoints } from '../vectorTile.spec';
/**
* Mapbox Vector Feature types are all bundled in one class
* to make it easier to read. Primarily contains an id, properties, and geometry.
* The now deprecated S2 model extends this class to include indices and tessellation data.
*/
export default class MapboxVectorFeature {
#private;
id?: number;
version: number;
properties: Properties;
extent: number;
type: OldVectorFeatureType;
isS2: boolean;
/**
* @param pbf - the pbf protocol we are reading from
* @param end - the position to stop at
* @param isS2 - whether the layer is a deprecated S2 layer or Mapbox layer.
* @param extent - the extent of the vector tile
* @param version - the version of the vector tile. S2 is 5, Mapbox is 1
* @param keys - the keys in the vector layer to pull from
* @param values - the values in the vector layer to pull from
*/
constructor(pbf: PbfReader, end: number, isS2: boolean, extent: number, version: number, keys: string[], values: Value[]);
/** @returns - the geometry type of the feature */
geoType(): VectorGeometryType;
/** @returns - true if the type of the feature is points */
isPoints(): boolean;
/** @returns - true if the type of the feature is lines */
isLines(): boolean;
/** @returns - true if the type of the feature is polygons */
isPolygons(): boolean;
/** @returns - true if the type of the feature is points 3D */
isPoints3D(): boolean;
/** @returns - true if the type of the feature is lines 3D */
isLines3D(): boolean;
/** @returns - true if the type of the feature is polygons 3D */
isPolygons3D(): boolean;
/**
* @returns - MapboxVectorTile's do not support m-values so we return false
*/
get hasMValues(): boolean;
/**
* @returns - a default bbox. Since no bbox is present, the default is [0, 0, 0, 0]
* also MapboxVectorTile's do not support 3D, so we only return a 2D bbox
*/
bbox(): BBox | BBox3D;
/**
* @returns - regardless of the type, we return a flattend point array
*/
loadPoints(): VectorPoints;
/**
* @returns - an array of lines. The offsets will be set to 0
*/
loadLines(): VectorLinesWithOffset;
/**
* @returns - [flattened geometry & tesslation if applicable, indices]
*/
loadGeometryFlat(): [geometry: number[], indices: number[]];
/**
* @returns - vector geometry relative to feature type.
*/
loadGeometry(): VectorGeometry;
/**
* @returns - an array of indices for the geometry
*/
readIndices(): number[];
/**
* Add tessellation data to the geometry
* @param geometry - the geometry to add the tessellation data to
* @param multiplier - the multiplier to apply the extent shift
*/
addTessellation(geometry: number[], multiplier: number): void;
}
//# sourceMappingURL=vectorFeature.d.ts.map