Uploaded October 2020 | Updated September 2026, 2 weeks ago
Convert a polygon to a raster with gdal rasterize. Continue developing the python zonal statistics algorithm. Convert the temporary vector layer to a raster and subset the input raster to match the extent of the polygon. This step will get us ready to actually pull the raster data and start calculating statistics. Check out the code on opensourceoptions.com.
Code is available at: opensourceoptions.com/blog/zonal-statistics-algorithm-with-python-in-4-steps
Visit opensourceoptions.com for more content and courses
Convert a polygon to a raster with gdal rasterize. Continue developing the python zonal statistics algorithm. Convert the temporary vector layer to a raster and subset the input raster to match the extent of the polygon. This step will get us ready to actually pull the raster data and start calculating statistics. Check out the code on opensourceoptions.com.
Code is available at: opensourceoptions.com/blog/zonal-statistics-algorithm-with-python-in-4-steps
Visit opensourceoptions.com for more content and courses










