I used below codes to create shapefile layer:
OGRDataSource *poDS, *poSHPDS; OGRLayer *poSHPLayer; ... poSHPLayer = poSHPDS->CreateLayer (shpFileName, NULL, wkbPolygon , NULL);
And I used below code to create feature:
OGRFeature *poSHPFeature; poSHPFeature = OGRFeature::CreateFeature (poSHPLayer->GetLayerDefn()); poSHPFeature->SetGeometry (poGeometry);
But when I tried to add create a LineString feature into shapefile layer. I got the error:
"Attempt to write non-polygon geometry to polygon type shapefile". Please see my image.
How can I add linestring into layer (shapefile) ?