update readme
Vladimir Agafonkin authored
89fc0250
Name Last commit Last update
bench add multi-ring GeoJSON types, close #4, close #5
debug bump version
src bump version
test fix simplify test
.gitignore minor cleanup
LICENSE add license and update readme
README.md update readme
package.json bump version

geojson-vt — 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, { // all parameters are optional, wit sensible defaults
	baseZoom: 14, // max zoom to preserve detail on
	maxZoom: 4, // 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

Here's geojson-vt action in Mapbox GL JS, dynamically loading a 100Mb US zip codes GeoJSON with 5.4 million points:

There's a convenient page to test out geojson-vt on different data. Run npm install to install dependencies, then npm run build-dev. Now open debug/index.html in your browser and drag any GeoJSON on the page, watching the console.