python-rasterstats
python-rasterstats copied to clipboard
If polygons smaller than a pixel, stats not computed
I've found that for the polygons that happen to be smaller than the image pixel, zonal_stats returns empty results. Although there are other packages to extract pixel values from points, in my case I have polygons of multiple sizes. If a polygon is larger than the pixel I need the zonal stats, but if it is smaller, just the pixel value would do. I suppose that it would be fairly easy to change (if min=max, just return one value). Thanks for this awesome package! Much faster than R.
See https://pythonhosted.org/rasterstats/manual.html#rasterization-strategy