[gdal-dev] Polygonize and 8CONNECTED

Francis Markham fmarkham at gmail.com
Thu Mar 10 02:39:59 EST 2011


Hi all,

I was writing to enquire about the status of the "8CONNECTED=8" option in
the Polygonize function of GDAL 1.8.  I would expect that this option joins
all pixels of equal value that are diagonally adjacent into a single
polygon.

However, with the following raster dataset (see
http://i.imgur.com/jdUla.png) I receive two polygons in my output
shapefile (see
http://i.imgur.com/CZWMU.png ).  For a copy of the raster, see
http://dl.dropbox.com/u/6732375/mish9000.img.zip  I am calling polygonize
from GDAL's python bindings, which reports itself as "GDAL 1.8.0, released
2011/01/12".  My code looks like:

gdal.Polygonize(tmprasterband, tmprasterband, shapefile_polygons_layer, 0,
["8CONNECTED=8"])


Is this the expected behaviour or a bug?  Can I modify my call to polygonize
to get the desired behaviour?  If not, how would I merge multiple polygons
with the same attribute value (an id number) into a single geometry?

Thanks for your help,

Francis Markham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110310/5c14ae7a/attachment.html


More information about the gdal-dev mailing list