Skip to content

Instantly share code, notes, and snippets.

@cindygis
Last active August 29, 2015 14:16
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 cindygis/c88394713a260733071d to your computer and use it in GitHub Desktop.
Save cindygis/c88394713a260733071d to your computer and use it in GitHub Desktop.
Returns the ESRI WKT for a given coordinate system from epsg.io
#
# @date 04/03/2015
# @author Cindy Williams
#
# Returns the ESRI WKT for a given EPSG from epsg.io
# Adapted from http://geospatialpython.com/2014/12/wkt-epsg-strings-made-easy.html
#
def getPRJwkt(epsg):
import urllib
sr_site = "http://epsg.io"
spatial_vendor = "esriwkt" # ESRI
f=urllib.urlopen("{0}/{1}.{2}".format(sr_site, epsg, spatial_vendor))
return (f.read())
print getPRJwkt(4326)
# returns GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment