[gdal-dev] How to create feature LineString in a Polygon shape file layer ?

taibc taibc_coltech at yahoo.com
Sat Jun 8 01:16:57 PDT 2013


Hi everyone,

I used below codes to create ShapeFile layer

OGRDataSource       *poDS,  *poSHPDS;
OGRLayer   *poSHPLayer;
......
poSHPLayer = poSHPDS->CreateLayer (shpFileName, NULL, wkbPolygon , NULL);

And I used below codes to create feature:

OGRFeature *poSHPFeature; 
poSHPFeature = OGRFeature::CreateFeature (poSHPLayer->GetLayerDefn());  
poSHPFeature->SetGeometry (poGeometry);

But when I tried to add create a LineString feature into shape file layer. I
got the error: "*Attempt to write non-polygon geometry to polygon type shape
file*". Please see my image. 

<http://osgeo-org.1560.x6.nabble.com/file/n5058827/LineString.png> 

How can I add linestring into layer (shape file) ?




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-create-feature-LineString-in-a-Polygon-shape-file-layer-tp5058827.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list