[gdal-dev] How to add a OGRSpatialReference to an OGRLayer?

Frank Warmerdam warmerdam at pobox.com
Tue Sep 30 17:28:01 EDT 2008


On Tue, Sep 30, 2008 at 11:11 PM, Tom Kazimiers <2voodoo at gmx.de> wrote:
>
>>
>> Tom,
>>
>> In fact there is no GDAL way to do this.  You can however manually
>> put a .prj file with an ArcGIS PE string along side the shapefiles.
>>
>> Best regards,
>>
>>
> Frank,
>
> thanks for the answer. So does this actually mean I have to look if
> there is a .prj file - if not create one by myself (maybe ask the user
> for the parameters) and then load the file with OGR? And if a spatial
> reference of a layer is NULL I have to create also a (new) .prj file (in
> case of the one provided is damaged).

Tom,

The OGR shapefile driver will read .prj files and return the coordinate
system properly OGR-ified from the layer.  It will also properly write .prj
files, but only if you pass the spatial reference into the CreateLayer() call.
There is no facility for updating the coordinate system of an existing
layer via OGR.

Best regards,

> thanks, regards,
> Tom
>



-- 
---------------------------------------+--------------------------------------
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