Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows:

wkt = dataset.GetProjection()
# wkt is 'PROJCS["GDA_1994_Transverse_Mercator",GEOGCS["GDA_1994",DATUM["GDA_1994",SPHEROID["GRS_1980",6378137,298.2572221010002],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]'

Using the WKT string, I can create a SpatialReference instance as follows:

src = osr.SpatialReference()

This is easy-peasy. I can extract several parameters of the projection from src such as the UTM zone, etc., easily enough. But I can't figure out how to extract something like the name of the projection, i.e. "GDA_1994_Transverse_Mercator". This has surely got to be possible, but the Python API documentation may as well be nonexistent for all the use it is.

How do I extract the names of the projection and the geographic coordinate system?

share|improve this question
up vote 20 down vote accepted

See the OGR Projections tutorial and the OGRSpatialReference class. In particular, the GetAttrValue method.

Here's a worked example.

from osgeo import gdal,osr
print prj

if srs.IsProjected:
    print srs.GetAttrValue('projcs')
print srs.GetAttrValue('geogcs')

For my raster this prints:

PROJCS["WGS 84 / UTM zone 55N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",147],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32655"]]
'WGS 84 / UTM zone 55N'
'WGS 84'
share|improve this answer
Awesome, thanks! – npo May 10 '13 at 5:59
+1 for the answer and the updated links ;) – Barbarossa Mar 13 at 5:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.