Hello List,<br><br>I hope you will be able to help me. I'm stuck on a problem. <br>I'm trying to reconstruct within my Python script polygons from a shapefile that belong together. <br><br>So I naturally perfomed:<br>
<br>geom_tmp = ogr.CreateGeometryFromWkb(ftr.GetGeometryRef().ExportToWkb())<br>geom.AddGeometryDirectly(geom_tmp)<br>
<br>However this works only when the geometry to add is of type POLYGON. This _doesn't_ work with type MULTIPOLYGON (exit code 3). <br><br>My question: is there a way to add MULTIPOLYGONs to an existing Geometry? <br>
<br>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?<br>
<br>Help very much appreciated.<br><br>Many thanks,<br>Daniel <br>