r.stats.zonal(1)
β¨ r.stats.zonal β the manual page, but make it make sense β¨
okay so bestie, you're reading the GRASS GIS User's Manual page for r.stats.zonal(1) π This is the one that does category or object oriented statistics β aka accumulator-based statistics β and honestly? It's giving main character energy. Let's go πΈ
π NAME π
r.stats.zonal β calculates category or object oriented statistics (accumulator-based statistics) π
π KEYWORDS π
raster, statistics, zonal statistics β yes those three, no cap π¦
β¨ SYNOPSIS β¨
r.stats.zonal
r.stats.zonal --help
r.stats.zonal [-cr] base=name cover=name method=string output=name
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π© Flags π©
-cβ Cover values extracted from the category labels of the cover map π like, it grabs the labels, not the raw numbers, iykyk-rβ Create reclass map with statistics as category labels π it makes you a whole reclass map, iconic--overwriteβ Allow output files to overwrite existing files π₯--helpβ Print usage summary π--verboseβ Verbose module output π¬--quietβ Quiet module output π€«--uiβ Force launching GUI dialog π₯οΈβ¨
π§ Parameters π§
base=name[required] β Name of base raster map πΊοΈcover=name[required] β Name of cover raster map πΈmethod=string[required] β Method of object-based statistic π
Options for method: count, sum, min, max, range, average, avedev, variance, stddev, skewness, kurtosis, variance2, stddev2, skewness2, kurtosis2
And here's what each one actually does, spelled out π:
count: Count of values in specified objectssum: Sum of values in specified objectsmin: Minimum of values in specified objectsmax: Maximum of values in specified objectsrange: Range of values (max - min) in specified objectsaverage: Average of values in specified objectsavedev: Average deviation of values in specified objectsvariance: Variance of values in specified objectsstddev: Standard deviation of values in specified objectsskewness: Skewness of values in specified objectskurtosis: Kurtosis of values in specified objectsvariance2: (2-pass) Variance of values in specified objectsstddev2: (2-pass) Standard deviation of values in specified objectsskewness2: (2-pass) Skewness of values in specified objectskurtosis2: (2-pass) Kurtosis of values in specified objectsoutput=name[required] β Resultant raster map π
π DESCRIPTION π
r.stats.zonal is a tool to analyse exploratory statistics of a floating-point "cover layer" according to how it intersects with objects in a "base layer" π¦ A variety of standard statistical measures are possible. This type of analysis is often called zonal statistics. The zones are specified as the base raster map and the statistics are computed from cells in the cover raster map. Notably, the output of this module is spatial: the resulting values are recorded as cell values in the output raster map. Like, the answer itself becomes a map. Ate. π
π NOTES π
r.stats.zonal is intended to be a partial replacement for r.statistics β it comes with support for floating-point cover maps at the expense of not supporting quantiles π For this, see r.stats.quantile. So like, trade-offs, bestie. You can't have everything (yet). π
π EXAMPLE π
In this example, the raster polygon map zipcodes in the North Carolina sample dataset is used to calculate zonal raster statistics using the elevation raster map πΈ
g.region raster=zipcodes -p
# pixel count in zipcode areas
r.stats.zonal base=zipcodes cover=elevation method=count output=zipcodes_elev_count
r.colors zipcodes_elev_count color=gyr -g
# average elevation in zipcode areas
r.stats.zonal base=zipcodes cover=elevation method=average output=zipcodes_elev_avg
r.colors zipcodes_elev_avg color=elevation -g
Figure: ZIP code map on the left shows ZIP code areas, elevation map the respective values per pixel, zonal statistics map on the right shows the average elevation per zone (all maps: spatial subset) π
π SEE ALSO π
r.stats.quantilefor computing quantiles in zones (objects in base raster map) πr.quantilefor computing quantiles of a whole raster map πr.statisticsfor categorical (integer) zonal statistics πr.univarfor zonal statistics with textual (non-spatial) output π¬v.vect.statsfor statistics of vector points in vector areas π―
π« AUTHOR π«
Glynn Clements π«Ά (thank you for your service, legend)
π₯ SOURCE CODE π₯
Available at: r.stats.zonal source code (history)
Accessed: Saturday Jan 17 05:41:00 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the whole page, bestie π that was GRASS GIS 8.4.2, dated Saturday Jan 17 05:41:00 2026, straight from the GRASS Development Team, Β© 2003-2025 β go compute some zones, you absolute icon πβ¨π
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms