Last active
October 9, 2019 22:09
-
-
Save jpoehnelt/efa60356ae407bd126e1a9c3f9ba7797 to your computer and use it in GitHub Desktop.
This file contains 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
var EXTENT = [-Math.PI * 6378137, Math.PI * 6378137]; | |
function xyzToBounds(x, y, z) { | |
var tileSize = EXTENT[1] * 2 / Math.pow(2, z); | |
var minx = EXTENT[0] + x * tileSize; | |
var maxx = EXTENT[0] + (x + 1) * tileSize; | |
// remember y origin starts at top | |
var miny = EXTENT[1] - (y + 1) * tileSize; | |
var maxy = EXTENT[1] - y * tileSize; | |
return [minx, miny, maxx, maxy]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment