[gdal-dev] Can't create feature on layer for polygon
Hugo Benicio
hbobenicio at gmail.com
Mon Oct 22 09:31:59 PDT 2012
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 <hbobenicio at gmail.com> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121022/1f1c0f23/attachment.html>
More information about the gdal-dev
mailing list