Last active
August 29, 2015 14:16
-
-
Save cindygis/c88394713a260733071d to your computer and use it in GitHub Desktop.
Returns the ESRI WKT for a given coordinate system from epsg.io
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
# | |
# @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