Skip to content

Instantly share code, notes, and snippets.

@websofter
Created July 2, 2021 15:10
Show Gist options
  • Select an option

  • Save websofter/0faf726277e077a691cce13205decaeb to your computer and use it in GitHub Desktop.

Select an option

Save websofter/0faf726277e077a691cce13205decaeb to your computer and use it in GitHub Desktop.
Convert x,y to lat, long with pyproj
import pyproj
def get_lat_lng(x, y):
#x = 174055.2462
#y = 614374.1559
'''
ISRAEL GEO METADATA get from https://www.expertgps.com/convert-coordinates/
hddd.ddddd° (Lat/Lon Degrees)
hddd° mm.mmm' (Lat/Lon Degrees & Minutes)
hddd° mm' ss.s" (Lat/Lon Deg. Min. Sec.)
Universal Transverse Mercator (UTM)
Military Grid Reference System (MGRS)
Israel TM Grid - EPSG 2039
World Geodetic System 1984 (WGS 84) - EPSG 4326
World Geodetic System 1972 (WGS 72) - EPSG 4322
European 1950, Iraq and Israel
Israel 1993 - EPSG 4141
CODE = 972
UTM Zone = 36R
lat = 31.6245213
long = 34.7210813
'''
wgs84 = pyproj.Proj(projparams = 'epsg:4326')
InputGrid = pyproj.Proj(projparams = 'epsg:2039')
c = pyproj.transform(InputGrid, wgs84, x, y)
return {'lat': c[0], 'lng': c[1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment