<p dir="ltr">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.<br>
</p>
<div class="gmail_quote">On 20 Aug 2014 07:56, "John Twilley" <<a href="mailto:mathuin@gmail.com">mathuin@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The program is not shifting the pixels, but the program does assume<br>
the pixels to be points and not rectangular areas so maybe I will have<br>
to shift the pixels. Do you know what transformation I would need to<br>
use?<br>
<br>
Jack.<br>
--<br>
mathuin at gmail dot com<br>
<br>
<br>
On Tue, Aug 19, 2014 at 7:17 PM, Chaitanya kumar CH<br>
<<a href="mailto:chaitanya.ch@gmail.com">chaitanya.ch@gmail.com</a>> wrote:<br>
> Jack,<br>
> The GDALPolygonize algorithm draws the polygon edges along the pixel edges.<br>
> It assumes the pixels to be rectangular areas instead of points.<br>
> In the example you described, the first polygon should contain four vertices<br>
> with the pixel in the centre.<br>
> Make sure that the program you are using to display them is not shifting the<br>
> pixels.<br>
><br>
> On 20 Aug 2014 07:12, "John Twilley" <<a href="mailto:mathuin@gmail.com">mathuin@gmail.com</a>> wrote:<br>
>><br>
>> I am trying to use GDAL's polygonize algorithms to help me identify<br>
>> regions in landcover data. I made a trivial example, but I am having<br>
>> trouble understanding the results that I get, nor can I determine how<br>
>> to get the results I want.<br>
>><br>
>> Given the following raster:<br>
>><br>
>> 11 11 11 11 11<br>
>> 11 11 11 11 11<br>
>> 11 11 12 11 11<br>
>> 11 11 11 11 11<br>
>> 11 11 11 11 11<br>
>> 11 11 11 11 11<br>
>><br>
>> If I were to polygonize this raster, I would expect two polygons: one<br>
>> which contains the single point 12, and another with an outer ring was<br>
>> the perimeter of the raster and an inner ring circling the single<br>
>> point 12. I would also expect that the first polygon would contain<br>
>> the single point 12 and that the second polygon would contain all the<br>
>> points 11.<br>
>><br>
>> Instead, what I got was a polygon starting from the single point 12<br>
>> and extending down and to the right one pixel, and another polygon<br>
>> with an outer ring that went off the down and right edges and an inner<br>
>> ring equal to the first polygon's outer ring. The first polygon<br>
>> doesn't actually contain any points and the second one doesn't contain<br>
>> any points on either ring but does contain all the other points.<br>
>><br>
>> What do I need to do to get the results I am expecting?<br>
>><br>
>> Jack.<br>
>> --<br>
>> mathuin at gmail dot com<br>
>> _______________________________________________<br>
>> gdal-dev mailing list<br>
>> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>