I have one polygon shapefile and one raster file (both EPSG: 4326) and I am calculating the minimum, maximum and average raster value in all polygons using two methods:
- QGIS 3.16.10,
Zonal statistics
tool - Python 3.9.7, Rasterstats 0.15.00,
stats = rs.zonal_stats(gdf, file, stats = ['mean', 'min', 'max'], nodata = -999, all_touched=True)
When I compare the result, most numbers are different (and not just rounding errors). Sometimes, the mean, minumum and maximum ist the same. Sometimes, either of the minimum or maximum (and hence the mean) is different, sometimes all three are different.
What could be the reason behind that?
all_touched=True