Hello List,

I hope you will be able to help me. I'm stuck on a problem.
I'm trying to reconstruct within my Python script polygons from a shapefile
that belong together.

So I naturally perfomed:

geom_tmp = ogr.CreateGeometryFromWkb(ftr.GetGeometryRef().ExportToWkb())
geom.AddGeometryDirectly(geom_tmp)

However this works only when the geometry to add is of type POLYGON. This
_doesn't_ work with type MULTIPOLYGON (exit code 3).

My question: is there a way to add MULTIPOLYGONs to an existing Geometry?

What I don't understand is that when CreateGeometryFromWkb returns a
MULTIPOLYGON it actually returns a GEOMETRY instead of a GEOMETRYCOLLECTION,
thus preventing looping on each individual geometry with GetNumGeometries.
Would there be a way to cast the polygon to a multipolygon?

Help very much appreciated.

Many thanks,
Daniel
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to