Skip to content
simple tile utilities
Branch: master
Clone or download
pirxpilot and mourner simplify getParent (#31)
`x >> 1` is the fastest way of doing `Math.floor(x / 2)` which is what
we need here
Latest commit 7df684f Jul 27, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.eslintrc add eslint and clean up code style Sep 2, 2015
.gitignore add eslint and clean up code style Sep 2, 2015
.travis.yml add node 0.12 Sep 2, 2015
LICENSE Initial commit Aug 14, 2014
README.md Update readme examples Dec 2, 2016
bench.js add eslint and clean up code style Sep 2, 2015
index.js simplify getParent (#31) Jul 27, 2017
package.json Move package to @mapbox namespace. Dec 2, 2016
test.js Fix Tile X wrapping issue (#32) Jul 26, 2017

README.md

tilebelt

Build Status Coverage Status

simple tile utilities

install

npm install @mapbox/tilebelt

usage

var tilebelt = require('@mapbox/tilebelt');

var tile = [10,15,8] // x,y,z

console.log(tilebelt.tileToGeoJSON(tile));
console.log(tilebelt.getParent(tile));

features

function description
tileToGeoJSON(tile) get a geojson representation of a tile
tileToBBOX(tile) get the bbox of a tile
bboxToTile(bbox) get the smallest tile to cover a bbox
getChildren(tile) get the 4 tiles one zoom level higher
getParent(tile) get the tile one zoom level lower
getSiblings(tile) get the 3 sibling tiles for a tile
hasSiblings(tiles, tile) check to see if an array of tiles contains a tiles siblings
hasTile(tiles, tile) check to see if an array of tiles contains a particular tile
tilesEqual(tile1, tile2) check to see if two tiles are the same
tileToQuadkey(tile) get the quadkey for a tile
quadkeyToTile(quadkey) get the tile for a quadkey
pointToTile(lon, lat, zoom) get the tile for a point at a specified zoom level
pointToTileFraction(lon, lat, zoom) get the precise fractional tile location for a point at a zoom level

tests

npm test

benchmarks

npm run bench
You can’t perform that action at this time.