Get WKT for coordinate system from

A while ago I came across a post on GeospatialPython for retrieving the WKT for a coordinate system from Spatial Reference.

I adapted the script to retrieve the ESRI WKT for a coordinate system from instead.

# @date 04/03/2015
# @author Cindy Williams
# Returns the ESRI WKT for a given EPSG from
# Adapted from
def getPRJwkt(epsg):
import urllib
sr_site = ""
spatial_vendor = "esriwkt" # ESRI
f=urllib.urlopen("{0}/{1}.{2}".format(sr_site, epsg, spatial_vendor))
return (
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]]

view raw

hosted with ❤ by GitHub

There are a variety of output options, so it’s just a matter of changing spatial_vendor to suit your needs.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.