I would like to know how the zonal_stats()
function from the library rasterstats
works, as I am calculating the mean values of a raster within a polygon. If a raster cell touches partially the polygon boundaries, is the whole cell included in the statistics? or is it "clipped" and then calculated?
I cannot see a reference in rasterstats documentation.
-
What GIS or programming language is this? Python? This package? pythonhosted.org/rasterstats/rasterstats.html– SpacedmanSep 10, 2021 at 13:59
-
Yes, and the parameter is all_touched. Thank you– GoldenTomatoSep 17, 2021 at 7:53
1 Answer
It's explained in the docs that @Spacedman linked, via the all_touched
parameter:
all_touched: bool, optional
Whether to include every raster cell touched by a geometry, or only those having a center point within the polygon. defaults to False