[gdal-dev] Preserving feature Information from Shapefile

Wuerfel, Hannes Hannes.Wuerfel at student.hpi.uni-potsdam.de
Mon Nov 19 09:56:02 PST 2012


Hi all,

I'm new to gdal OGR Simple Feature Library.
What I'd like to do is to read an esri shapefile, modify the geometry and feature information and write a new shapefile to disc.
I went through the read/write tutorial and I can write back the Geometry to the new shapefile but I'm stugged with copying the other feature informations.

Can somebody please explain to me how it should be done?

What I do is basically this:

open the source file
fetch a layer
determine the geometry type used
open the destination file
create destination layer with source Layer Spatial Reference and source geometry type
and then:
while(srcFeature = srcLayer->GetNextFeature()) != NULL)
{
      // no working feature duplication ...

     // working ogrgeometry duplication
     // ...
     // destinationFeature->SetGeometryDirectly(...);
}

Best regards.
Hannes


More information about the gdal-dev mailing list