New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mapbox-vector-tile

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox-vector-tile

Parses mapbox vector tiles

latest
npmnpm
Version
0.3.0
Version published
Weekly downloads
393
74.67%
Maintainers
1
Weekly downloads
 
Created
Source

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

import { VectorTile } from 'mapbox-vector-tile';

// data is either a Buffer or a Uint8Array containing binary data.
const tile = new VectorTile(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);

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

FAQs

Package last updated on 23 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts