UNPKG
kea-geo
Version:
latest (0.0.12)
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Collection of geo related utility
github.com/ardhi/kea-geo
ardhi/kea-geo
kea-geo
/
src
/
tileToLat.js
7 lines
(5 loc)
•
297 B
JavaScript
View Raw
1
2
3
4
5
6
7
// source: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#ECMAScript_.28JavaScript.2FActionScript.2C_etc..29
module
.
exports
=
function
(
y, zoom
) {
const
n =
Math
.
PI
-
2
*
Math
.
PI
* y /
Math
.
pow
(
2
, zoom)
return
(
180
/
Math
.
PI
*
Math
.
atan
(
0.5
* (
Math
.
exp
(n) -
Math
.
exp
(-n)))) }