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.
How can I add linestring into layer (shape file) ?