[gdal-dev] Re: Multipart to singlepart
Even Rouault
even.rouault at mines-paris.org
Thu Dec 9 16:46:05 EST 2010
>
> I have modified a little your code - https://gist.github.com/735330 - and I
> have this message:
> Polygon added.
> Traceback (most recent call last):
> File "PaoloIsGreat.py ", line 32, in <module> multipoly2poly(in_lyr,
> out_lyr)
> File "PaoloIsGreat.py ", line 8, in multipoly2poly for geom_part in geom:
> TypeError: 'Geometry' object is not iterable
Geometry have been made iterable only since GDAL 1.7.0. You need to upgrade
your GDAL version or modify a bit the script to make the iteration with the
OGR API.
instead of :
for geom_part in geom:
addPolygon(geom_part.ExportToWkb(), out_lyr)
try :
for i in range(geom.GetGeometryCount()):
geom_part = geom.GetGeometryRef(i)
addPolygon(geom_part.ExportToWkb(), out_lyr)
More information about the gdal-dev
mailing list