0.0.4 • Published 10 months ago

@mapmetrics/vector-tile v0.0.4

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
10 months ago

vector-tile

Example

import { VectorTile } from "@mapmetrics/vector-tile";
import Protobuf from "pbf";

const tile = new VectorTile(new Protobuf(data));

// Contains a map of all layers
tile.layers;

const landuse = tile.layers.landuse;

// Amount of features in this layer
landuse.length;

// Returns the first feature
landuse.feature(0);

Vector tiles contained are gzip-encoded, so a complete example of parsing them with the native zlib module would be:

import { VectorTile } from "@mapmetrics/vector-tile";
import Protobuf from "pbf";
import { gunzipSync } from "zlib";

const buffer = gunzipSync(data);
const tile = new VectorTile(new Protobuf(buffer));

Install

To install:

npm install @mapmetrics/vector-tile
0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago