Fast, tidy zonal statistics for multiband rasters & polygon layers
Version 0.5.0 Β· QGIS 3.34+This plugin summarises a multiband raster over the polygons of a vector layer and writes a clean CSV. Instead of re-reading the raster once per polygon (the slow, classic pattern), it reads the raster in bounded tiles and aggregates every zone and band together with NumPy β so the work scales with the raster area touched, not with polygons Γ bands.
Overlapping zones handled Multipart polygons Per-band nodata Bounded memory Atomic output
Available from the Raster β Multiband Zonal Stats menu, the toolbar, and the Processing Toolbox (two algorithms). Runs in the background with progress and a safe Cancel.
Measured quantities where averaging makes sense.
Examples: elevation, temperature, rainfall, reflectance, NDVI.
Statistics: countnodata minmax summean stddev
Layouts: Long or Wide.
Discrete class codes where averaging is meaningless.
Examples: land cover, soil type, zoning, CORINE classes.
Statistics: majorityminority varietycount nodata
Layouts: Summary, Class breakdown, or Class counts.
| Name | Meaning |
|---|---|
count | Number of valid (non-nodata) pixels in the zone |
nodata | Number of nodata pixels covered by the zone |
min / max | Smallest / largest valid value |
sum | Sum of valid values |
mean | Average of valid values |
stddev | Population standard deviation (Γ· n), like QGIS's own tool |
| Name | Meaning |
|---|---|
majority | Most common class (ties β lowest class code) |
minority | Least common class (ties β lowest class code) |
variety | Number of distinct classes present |
count / nodata | Valid / nodata pixel counts |
Every row of every layout begins with a unique fid.
fid,polygon_id,polygon_name,band_index,band_name,count,mean,stddev 1,101,North field,1,ndvi,4210,0.62,0.11 2,101,North field,2,ndvi_may,4210,0.58,0.09 3,102,South field,1,ndvi,3980,0.71,0.08
fid,polygon_id,polygon_name,ndvi_mean,ndvi_stddev,ndvi_may_mean,ndvi_may_stddev 1,101,North field,0.62,0.11,0.58,0.09 2,102,South field,0.71,0.08,0.66,0.07
fid,polygon_id,polygon_name,band_index,band_name,majority,minority,variety,count 1,101,North field,1,landcover,3,4,4,16 2,102,South field,1,landcover,2,1,3,16
fid,polygon_id,polygon_name,band_index,band_name,class,pixel_count,fraction 1,101,North field,1,landcover,1,4,0.250 2,101,North field,1,landcover,2,4,0.250 3,101,North field,1,landcover,3,5,0.312 4,101,North field,1,landcover,4,3,0.188
fid,polygon_id,polygon_name,band_index,band_name,class_1,class_2,class_3,class_4 1,101,North field,1,landcover,4,4,5,3 2,102,South field,1,landcover,7,4,1,4
Columns are the union of classes across all zones, so every row shares the
same columns β a class absent from a zone is simply 0.
Output columns keep the raster's own band names (falling back to
band_001, band_002β¦ when unnamed). Add an optional common
prefix and suffix to label a run of files:
| Band name | Prefix | Suffix | Wide column (sanitised) |
|---|---|---|---|
| NDVI | 2020_ | β | 2020_ndvi_mean |
| Surface Temp | β | β | surface_temp_mean |
| band 1 | β | _dry | band_1_dry_mean |
Wide headers are lowercased with spaces/punctuation turned into underscores; the raster's bands are never renamed.
fid column & decimal placesfidEvery row starts with a unique 1-based fid β a stable row identity. Handy
because polygon_id repeats across bands and classes, so it isn't a row key
on its own. Use fid for joins, database imports, or referencing a row.
Control the decimals of numeric cells. Full precision (the default) keeps every
digit; set 0β15 to fix the decimals β only floating-point cells (stats,
fraction) change; integers stay clean.
The Histogramβ¦ button (bottom-left of the dialog) opens a quick preview of a band's distribution β handy before you commit to an analysis.
Drawn with Qt directly β no extra Python packages needed.
The raster's CRS is the analysis CRS, and the raster is never resampled (that would fabricate pixel values). Zones are transformed into the raster CRS automatically when they differ.
If a layer's CRS is missing or wrong, set a Raster CRS or Zones CRS override. An override assigns a CRS (reinterprets coordinates) β it does not reproject the data.
. decimal, but your Excel expects a
,. Use Data β From Text/CSV and set the decimal separator, or reduce the
output to a few decimal places for cleaner numbers.
0, 255. Handy for categorical rasters where 0
marks out-of-boundary pixels. Open the Histogram first to spot which value to exclude.
| Setting | What it does |
|---|---|
| Tile size | Raster window read at a time. Larger = fewer reads, more memory. |
| Band chunk | Bands held in memory per pass. Lower it for many-band rasters on tight memory. |
| All touched | Include every pixel a polygon touches, not just pixel centres (slower). |