Package Exports
- s2-pmtiles
- s2-pmtiles/browser
- s2-pmtiles/dist/browser.d.ts
- s2-pmtiles/dist/browser.d.ts.map
- s2-pmtiles/dist/browser.js
- s2-pmtiles/dist/browser.js.map
- s2-pmtiles/dist/cache.d.ts
- s2-pmtiles/dist/cache.d.ts.map
- s2-pmtiles/dist/index.d.ts
- s2-pmtiles/dist/index.d.ts.map
- s2-pmtiles/dist/index.js
- s2-pmtiles/dist/index.js.map
- s2-pmtiles/dist/metadata.d.ts
- s2-pmtiles/dist/metadata.d.ts.map
- s2-pmtiles/dist/pmtiles.d.ts
- s2-pmtiles/dist/pmtiles.d.ts.map
- s2-pmtiles/dist/reader.d.ts
- s2-pmtiles/dist/reader.d.ts.map
- s2-pmtiles/dist/s2pmtiles.d.ts
- s2-pmtiles/dist/s2pmtiles.d.ts.map
- s2-pmtiles/dist/varint.d.ts
- s2-pmtiles/dist/varint.d.ts.map
- s2-pmtiles/dist/writer.d.ts
- s2-pmtiles/dist/writer.d.ts.map
Readme
s2-pmtiles

About
A Modified TypeScript implementation of the PMTiles library. It is backwards compatible but offers support for the S2 Projection.
Read The Spec
Install
#bun
bun add s2-pmtiles
# pnpm
pnpm add s2-pmtiles
# yarn
yarn add s2-pmtiles
# npm
npm install s2-pmtiles
# cargo
cargo install s2-pmtiles
NOTE
Everything after this needs to be updated.
Example use
const fs = from 'fs'
import { VectorTile } from 's2-pmtiles'
// assume you can read (.pbf | .mvt | .ovt)
const fixture = fs.readFileSync('./x-y-z.vector.pbf')
// Bun const fixture = new Uint8Array(await Bun.file('./x-y-z.vector.pbf').arrayBuffer())
// load the protobuf parsing it directly
const tile = new VectorTile(fixture)
console.log(tile)
// example layer
const { landuse } = tile.layers
// grab the first feature
console.log(landuse.feature(0))
console.log(landuse.feature(0).loadGeometry())
General Purpose API
Tile
Development
Requirements
You need the tool tarpaulin
to generate the coverage report. Install it using the following command:
cargo install cargo-tarpaulin
The bacon coverage
tool is used to generate the coverage report. To utilize the pycobertura package for a prettier coverage report, install it using the following command:
pip install pycobertura
Running Tests
To run the tests, use the following command:
# TYPESCRIPT
## basic test
bun run test
## live testing
bun run test:dev
# RUST
## basic test
cargo test
# live testing
bacon test
Generating Coverage Report
To generate the coverage report, use the following command:
cargo tarpaulin
# bacon
bacon coverage # or type `l` inside the tool