JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2578334
  • Score
    100M100P100Q214377F

Slice GeoJSON data into vector tiles efficiently

Package Exports

  • geojson-vt
  • geojson-vt/src/clip
  • geojson-vt/src/convert

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (geojson-vt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

GeoJSON Vector Tiles

A highly efficient JavaScript library for slicing GeoJSON data into vector tiles (or rather their JSON equivalent) on the fly, primarily for rendering purposes.

Created to power GeoJSON rendering in Mapbox GL JS, but can be useful for other data visualization purposes.

Usage

// build an initial index of tiles
var tileIndex = geojsonvt(geoJSON, {
    baseZoom: 14, // max zoom to preserve detail on
    maxZoom: 14, // zoom to slice down on first pass
    maxPoints: 100, // during first pass, stop slicing each tile below this number of points
    debug: 0 // debug level: 1 = some timing info; 2 = individual tiles timing;
});

// request a particular tile
var features = tileIndex.getTile(z, x, y).features;

Demo

To see a geojson-vt in action, run npm run build-dev, then open debug/index.html in your browser and drag any GeoJSON on the page. It was tested on files up to 100Mb: