s2-vector-tile
v2.0.12
Published
This library reads/writes Vector Tiles 2.0
Downloads
47
Readme
s2-vector-tile
About
A Modified TypeScript implementation of the Mapbox Vector Tile library. It is backwards compatible but offers a lot of new features and improvements including proper module treeshake.
Install
# npm
npm install s2-vector-tile
# pnpm
pnpm add s2-vector-tile
# yarn
yarn add s2-vector-tile
Example use
const fs = from 'fs'
import { VectorTile } from 's2-vector-tile'
const fixture = fs.readFileSync('./fixtures/14-8801-5371.vector.pbf')
const tile = new VectorTile(fixture) // load the protobuf parsing it directly
console.log(tile)
let { landuse } = tile.layers // 107 features
console.log(landuse.feature(0))
console.log(landuse.feature(0).loadGeometry())