vector-tile
This library reads Mapbox Vector Tiles and allows access to the layers and features.
It is based on @mapbox/vector-tile
with the following differences:
- this library does not depend on
@mapbox/point-geometry
, - this library uses
protobuf-ts
to decode protos, - this library is written in TypeScript,
- this library provides
Feature.asPoint()
,Feature.asLine()
,Feature.asPolygon()
to make it easier to work with geometries.
Install
npm i --save mapbox-vector-tile
Example
; // data is either a Buffer or a Uint8Array containing binary data.const tile = data; // Contains a map of all layerstilelayers; const landuse = tilelayerslanduse; // Amount of features in this layerlanduselength; // Returns the first featurelanduse;
Notes
- 64-bit numbers could be returned as number (the default), string or bigint.
You can specify the format using the second parameter of
VectorTile
. - The features id are always returned as a numerical string.
Changes
0.3.0 - Oct 22, 2020
- Switch to protobuf-ts.