Skip to content

Instantly share code, notes, and snippets.

@Fingel
Last active December 27, 2017 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fingel/97cf4cc0a0cb0a07477a521906f582ae to your computer and use it in GitHub Desktop.
Save Fingel/97cf4cc0a0cb0a07477a521906f582ae to your computer and use it in GitHub Desktop.
Return the SRID corresponding to the UTM zone for a given Latitude and Longtitude in WSG84
"""
Point must be in srid 4326 (Mercator projection)
Based on http://lists.osgeo.org/pipermail/postgis-users/2005-December/010204.html
"""
def point_to_srid(lat, lng):
if lat > 0:
base_srid = 32600 # northern hemisphere
else:
base_srid = 32700
utm = floor((lng + 186) / 6)
return base_srid + utm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment