Package Exports
- @mapbox/tile-cover
- @mapbox/tile-cover/index
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 (@mapbox/tile-cover) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tile-cover
Generate the minimum number of tiles to cover a GeoJSON Geometry.
Install
npm install @mapbox/tile-coverUsage
var cover = require('@mapbox/tile-cover');
var poly = JSON.parse(fs.readFileSync('./poly.geojson'));
var limits = {
min_zoom: 4,
max_zoom: 9
};
cover.geojson(poly.geom, limits);
cover.tiles(poly.geom, limits);
cover.indexes(poly.geom, limits);API
geojson(geom, limits)
Given a geometry, create cells and return them in a format easily readable by any software that reads GeoJSON.
geom(Object): GeoJSON geometrylimits(Object): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.
Returns Object, FeatureCollection of cells formatted as GeoJSON Features
tiles(geom, limits)
Given a geometry, create cells and return them in their raw form, as an array of cell identifiers.
geom(Object): GeoJSON geometrylimits(Object): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.
Returns Array.<Array.<number>>, An array of tiles given as [x, y, z] arrays
indexes(geom, limits)
Given a geometry, create cells and return them as quadkey indexes.
geom(Object): GeoJSON geometrylimits(Object): an object with min_zoom and max_zoom properties specifying the minimum and maximum level to be tiled.
Returns Array.<String>, An array of tiles given as quadkeys.
Tests
npm testBenchmarks
node bench.jsExamples
Polygons:

Lines:

Points:
