[gdal-dev] Setting the spatial reference of an existing shapefile with OGR

Jason Roberts jason.roberts at duke.edu
Thu Nov 12 19:33:39 EST 2009


Greetings OGR experts,

 

I have a shapefile for which no spatial reference was defined when the
shapefile was created, but I know the spatial reference and would like to
set it on this existing shapefile. Is this possible with the OGR Python API?

 

It looks like the only place that takes an OGRSpatialReference instance is
OGRDataSource::CreateLayer. This suggests that the only way to do it is to
call CreateLayer with the appropriate OGRSpatialReference instance and then
write all of the code to create the fields and copy all of the features from
the existing layer to the new one. Is this correct?

 

Thanks very much for any suggestions you can provide,

 

Jason

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20091112/fa9d1f85/attachment.html


More information about the gdal-dev mailing list