Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tile-to-geo

erf21ISC1.0.2

Transform tile x,y to lat,lng and back for spherical mercator.

geo, gis, EPSG:3857, spherical, mercator, projection, projections, tile, tiles, mbtiles, lat, lng, latitude, longitude

readme

tile-to-geo

Transform lat,zoom and lng,zoom to tile coordinates and back for spherical mercator projection.

Install

npm install tile-to-geo

Usage

assert(tu.lng_x(45, 1), 1);
assert(tu.lat_y(-45, 1), 1);

assert(tu.lng_x(160, 2), 3);
assert(tu.lat_y(-80, 2), 3);

assert(tu.x_lng(0, 2), -180);
assert(tu.y_lat(0, 2), 90);

assert(tu.x_lng(4, 2), 180);
assert(tu.y_lat(4, 2), -90);

Tests

npm test