Inverting y coordinate

This commit is contained in:
antoniocarlon 2018-05-08 16:54:53 +02:00
parent fafd4a364e
commit 3fba8a3091

View File

@ -3,6 +3,7 @@ RETURNS NUMERIC[] AS $$
import math import math
def tile2lnglat(z, x, y): def tile2lnglat(z, x, y):
n = 2.0 ** z n = 2.0 ** z
y = (1 << z) - y - 1
lon = x / n * 360.0 - 180.0 lon = x / n * 360.0 - 180.0
lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * y / n))) lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * y / n)))