[gdal-dev] Questions about polygonization

Chaitanya kumar CH chaitanya.ch at gmail.com
Tue Aug 19 19:32:56 PDT 2014


Try qgis to display the raster and the vector output. It shows the raster
pixels as rectangular areas. To confirm that there is no shift, compare
their extents using gdalinfo and ogrinfo.
 On 20 Aug 2014 07:56, "John Twilley" <mathuin at gmail.com> wrote:

> The program is not shifting the pixels, but the program does assume
> the pixels to be points and not rectangular areas so maybe I will have
> to shift the pixels.  Do you know what transformation I would need to
> use?
>
> Jack.
> --
> mathuin at gmail dot com
>
>
> On Tue, Aug 19, 2014 at 7:17 PM, Chaitanya kumar CH
> <chaitanya.ch at gmail.com> wrote:
> > Jack,
> > The GDALPolygonize algorithm draws the polygon edges along the pixel
> edges.
> > It assumes the pixels to be rectangular areas instead of points.
> > In the example you described, the first polygon should contain four
> vertices
> > with the pixel in the centre.
> > Make sure that the program you are using to display them is not shifting
> the
> > pixels.
> >
> > On 20 Aug 2014 07:12, "John Twilley" <mathuin at gmail.com> wrote:
> >>
> >> I am trying to use GDAL's polygonize algorithms to help me identify
> >> regions in landcover data.  I made a trivial example, but I am having
> >> trouble understanding the results that I get, nor can I determine how
> >> to get the results I want.
> >>
> >> Given the following raster:
> >>
> >> 11 11 11 11 11
> >> 11 11 11 11 11
> >> 11 11 12 11 11
> >> 11 11 11 11 11
> >> 11 11 11 11 11
> >> 11 11 11 11 11
> >>
> >> If I were to polygonize this raster, I would expect two polygons:  one
> >> which contains the single point 12, and another with an outer ring was
> >> the perimeter of the raster and an inner ring circling the single
> >> point 12.  I would also expect that the first polygon would contain
> >> the single point 12 and that the second polygon would contain all the
> >> points 11.
> >>
> >> Instead, what I got was a polygon starting from the single point 12
> >> and extending down and to the right one pixel, and another polygon
> >> with an outer ring that went off the down and right edges and an inner
> >> ring equal to the first polygon's outer ring.  The first polygon
> >> doesn't actually contain any points and the second one doesn't contain
> >> any points on either ring but does contain all the other points.
> >>
> >> What do I need to do to get the results I am expecting?
> >>
> >> Jack.
> >> --
> >> mathuin at gmail dot com
> >> _______________________________________________
> >> gdal-dev mailing list
> >> gdal-dev at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140820/f97d29fe/attachment-0001.html>


More information about the gdal-dev mailing list