For anyone else having the same problem like mine, I solved my issue just iterating over the wkbGeometryCollection, gathering all polygons in it and creating a feature for the my layer for each of them.
On Mon, Oct 22, 2012 at 1:31 PM, Hugo Benicio <[email protected]> wrote: > Ok, I've discovered that myPolygon has geometryType * > wkbGeometryCollection.* > When I try to: > newDataSource->CreateLayer("test",NULL, *wkbGeometryCollection*, > NULL); > it fails and returns NULL. > > So my question now is: How do I create a wkbGeometryCollection layer (if > possible) or how do I correctly change the geometry type of my geometry > (from *wkbGeometryCollection *to *wkbPolygon*)? > * > * > Thanks in advance, > Hugo BenĂcio. > > * > * > On Mon, Oct 22, 2012 at 11:24 AM, Hugo Benicio <[email protected]>wrote: > >> 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. >> > >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
