Stats zonales
✓ Published0🌍 Public
RRCura
Last edited Nov 13, 2012
Created on Nov 13, 2012
This example uses QGIS’s `QgsZonalStatistics` API to compute zonal statistics from a population raster (`popgrid.tif`) over vector polygons representing urban morphological zones (`UMZ_2000.shp`). It loads the vector layer via `QgsVectorLayer`, prompts the user for confirmation, then runs the calculation with a `ZS_` prefix for new attribute columns. The script prints the layer’s name, feature count, geometry type, and EPSG code before timing the operation, demonstrating a straightforward batch workflow for enriching polygon attributes with raster data.
AI-generated description