[gdal-dev] Can't create feature on layer for polygon

Hugo Benicio hbobenicio at gmail.com
Mon Oct 22 07:24:09 PDT 2012


Hi guys!

I'm trying to create a shapefile containing a single polygon, but
unfortunately I'm facing an error that I have no clue how to solve.
I'm successfuly creating a datasource and a layer with:

OGRLayer* testLayer = newDataSource->CreateLayer("test",NULL, wkbPolygon,
NULL);

Then when I try to create a feature containing a *previously
calculated**polygon like this:

OGRFeature* feature = OGRFeature::CreateFeature(testLayer->GetLayerDefn());
feature->SetGeometry(myPolygon);
OGRErr errorCode = testLayer->CreateFeature(feature);

The line 'testLayer->CreateFeature(feature)' fails returning the error code:
OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3

What am I missing here? How can I "make my geometry type supported"? Any
clues?
Maybe I have to set the geometry type somehow somewhere else (on the layer
or the geometry definition)... I don't know...

*(*) *FYI, 'myPolygon' is generated with the Intersection of other 2
Polygons
OGRGeometry *myPolygon = basinPolygon->Intersection(landscapePolygon);

Thanks in Advance,
Best Regards,
Hugo Benício.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121022/f8712825/attachment.html>


More information about the gdal-dev mailing list