No problems at least on the other side of bindings:
my $g = Geo::OGR::Geometry->new(
WKT=>'MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2, 3 2, 3 3, 2 3,2
2)),((3 3,6 2,6 4,3 3)))');
my $h = $g->ForceToPolygon;
say $h->AsText;
say $h->As(Format=>'GeoJSON');
output:
POLYGON ((1 1,5 1,5 5,1 5,1 1),(2 2,3 2,3 3,2 3,2 2),(3 3,6 2,6 4,3 3))
{ "type": "Polygon", "coordinates": [ [ [ 1.0, 1.0 ], [ 5.0, 1.0 ], [
5.0, 5.0 ], [ 1.0, 5.0 ], [ 1.0, 1.0 ] ], [ [ 2.0, 2.0 ], [ 3.0, 2.0 ],
[ 3.0, 3.0 ], [ 2.0, 3.0 ], [ 2.0, 2.0 ] ], [ [ 3.0, 3.0 ], [ 6.0, 2.0
], [ 6.0, 4.0 ], [ 3.0, 3.0 ] ] ] }
Ari
On 02.11.2015 17:13, Gane R wrote:
I am reading a file geodb and trying to convert multipolygon to Polygon
OGRGeometry *pGeom = NULL;
OGRGeometry *pForced = NULL;
pGeom = pOGRFeature->StealGeometry();
if(pGeom != NULL)
{
pForced =
OGRGeometryFactory::forceToPolygon(pGeom);
if(pForced != NULL)
{
pOGRFeature->SetGeometryDirectly(pForced);
}
}
char *pJsonString = pSrcGeom->exportToJson(); //Causes crash ...
Do any experience these ?
Gane
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev