Created
October 24, 2016 17:59
-
-
Save Scarysize/7a30cbc88ba7c3d56921a527385d6950 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function unproject(point, zoom) { | |
| return { | |
| lng: xLng(point.x, zoom), | |
| lat: yLat(point.y, zoom) | |
| }; | |
| } | |
| function xLng(x, zoom) { | |
| return x * 360 / Math.pow(2, zoom) - 180; | |
| } | |
| function yLat(y, zoom) { | |
| const y2 = 180 - y * 360 / Math.pow(2, zoom); | |
| return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment