Using qgis helped me see what you are saying. The raster pixels are
being treated as rectangular areas but the actual coordinates are the
*corners* of those areas. Modifying my code to offset the coordinates
by 0.5 causes the Contains test (and others) to produce results that
meet my
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
Hi Jack,
I'm not sure if I understand the description of the shapes you see.
Can you provide the WKT for them? I seem to get two polygons that look
like they should:
import numpy as np
import rasterio.features
from shapely.geometry import shape
ar = np.ones((6, 5), 'B') * 11
ar[2, 2] = 12
gt =
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
Hi Mike!
I get the same polygons you get -- what I don't understand is why I'm
getting those polygons instead of the ones that I expected. Can you
explain why those polygons look like they should?
Jack.
--
mathuin at gmail dot com
On Tue, Aug 19, 2014 at 7:15 PM, Mike Toews mwto...@gmail.com
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
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 math...@gmail.com wrote:
The program is not shifting the pixels, but the