Last active
June 25, 2018 07:00
-
-
Save chinying/598ffdf55d8b3d2138df72db4b3afdbe to your computer and use it in GitHub Desktop.
xy to latlng
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
from pyproj import Proj, transform | |
inProj = Proj(init='epsg:3414') | |
outProj = Proj(init='epsg:4326') | |
def swap(x, y): | |
return y, x | |
def xy_to_latlng(x, y): | |
return swap(*transform(inProj, outProj, x, y)) | |
def latlng_to_xy(lat, lng): | |
return transform(outProj, inProj, *swap(lat, lng)) | |
# test, should expect roughly 1.320932, 103.884887 | |
print(xy_to_latlng(33758.4143, 33695.5198)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment