[gdal-dev] Re: Multipart to singlepart

Sebastian E. Ovide sebastian.ovide at gmail.com
Thu Dec 9 19:40:44 EST 2010


Hi Andrea,

Just a note of warning:

if you have a point x,y that is inside the hole (so it doesn't belong the
the polygon), and you run some point in polygon query (intersection for
example) you will get that it is no part of any polygon.... but if you
convert the ring in two polygons using this method.... that point will
become part of a polygon (the ex hole)... So if for example the polygon
represent the field, the hole represent the water and the point is a boat,
after the conversion (ring to more polygons) the boat would be drained....
;)

Not sure if that is what you need....

On Thu, Dec 9, 2010 at 9:58 PM, iomeneandrei <aborruso at tin.it> wrote:

>
> Hi Even,
>
> Even Rouault wrote:
> >
> > 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)
> >
>
> now it works perfectly!!
>
> Thank you very much,
>
> Andrea
>
> -----
> Andrea Borruso
>
> ----------------------------------------------------
> email: aborruso at tin.it
> website: http://blog.spaziogis.it
> my 2.0 life: http://aborruso.spaziogis.it
> feed: http://feeds2.feedburner.com/Tanto
> 38° 7' 48" N, 13° 21' 9" E
> ----------------------------------------------------
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Multipart-to-singlepart-tp5807508p5820973.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Sebastian E. Ovide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101210/8ab6a5d4/attachment-0001.html


More information about the gdal-dev mailing list