@mapbox/vector-tile

Parse Mapbox Vector Tiles in JavaScript and access their layers and features as GeoJSON.

Library
npm
v3.0.0
402stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
65/100Good
Development Activity52
Maintenance48
Community80
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture80
Code Quality80
Innovation72
Learning Curve78

@mapbox/vector-tile reads binary Mapbox Vector Tiles (MVT) in JavaScript and exposes their layers and features for inspection. Given a protobuf-decoded tile buffer, it lets you enumerate layers, count and access features, read feature properties and geometry, and convert features to GeoJSON in geographic coordinates.

The library is a foundational building block of the vector-tile ecosystem, used by renderers, analysis tools, and tile servers to decode the compact MVT format into usable geometry. It depends on pbf for protobuf reading and point-geometry for coordinate types.

What You Get

  • A VectorTile class that decodes an MVT buffer into named layers
  • Per-layer feature access with length and feature(i) accessors
  • Feature geometry loading and toGeoJSON(x, y, z) conversion to geographic coordinates
  • Access to feature properties, IDs, and geometry types

Common Use Cases

  • Decoding vector tiles for custom map renderers
  • Extracting features from tiles for spatial analysis or conversion to GeoJSON
  • Inspecting and debugging vector tile contents in tooling and pipelines

Under The Hood

Architecture

The library is organized as a small set of classes: VectorTile reads the top-level protobuf message and builds a map of VectorTileLayer objects; each layer lazily decodes VectorTileFeature instances on demand. Features decode their zig-zag-encoded command geometry into point arrays and can project those to WGS84 via toGeoJSON using the tile’s coordinate and extent. Protobuf parsing is delegated to the pbf reader.

Tech Stack

Written in JavaScript, depending on pbf (v5+) for fast protobuf decoding, @mapbox/point-geometry for point types, and @types/geojson for typings. Distributed as an ES module with a VectorTile named export.

Code Quality

A mature, widely-depended-upon library (millions of weekly downloads) with a focused test suite and Mapbox governance. Lazy feature decoding keeps memory and CPU costs proportional to what the caller actually reads.

API Design

The API mirrors the MVT data model closely — tile, layers, features — which makes it intuitive for anyone familiar with the format. The two-step pattern of decoding with pbf and wrapping in VectorTile is well documented, and toGeoJSON provides a convenient bridge to standard tooling.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search