[gdal-dev] OSR: EPSG code and WKT definition (ESRI vs OGC)

Frank Warmerdam warmerdam at pobox.com
Thu Dec 17 10:12:43 EST 2009


Daniele Romagnoli wrote:
> Hi again list,
> I'm building a shapefile and, when setting the CRS, I use this code:
> .....
> t_srs = osr.SpatialReference()
> t_srs.SetFromUserInput("EPSG:32632")
> ....
> Looking at the generated PRJ, I see it uses the ESRI WKT definition [1].
> Is there a way to get the OGC definition [2] instead? (This one is 
> preserving the EPSG authority code inside)

Daniele,

ESRI .prj files are supposed to be in ESRI format, and so the shapefile
driver morphs appropriately.  There is no way to tell it not to.

However, you can export the srs to WKT and write it over the .prj file
if you want.

eg. (in python)

open('basename.prj','w').write(t_srs.ExportToWkt())

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list