-
-
Save koorukuroo/1c2ce363a0b918f9c0a6 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
def epsg_4326_to_900913(lon, lat): | |
x = lon * 20037508.34 / 180 | |
y = (math.log(math.tan((90 + lat) * math.pi / 360)) / (math.pi / 180)) * (20037508.34 / 180) | |
return x, y | |
def epsg_900913_to_4326(x, y): | |
lon = x * 180 / 20037508.34 | |
lat = (360 / math.pi) * math.atan(math.exp(y * math.pi / 20037508.34)) - 90 | |
return lon, lat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment