r.statistics(1)
π r.statistics β the GRASS GIS bestie manual π
okay so bestie, you're reading the manual for r.statistics(1) from the GRASS GIS User's Manual. pull up a chair, grab a strawberry π, and let's get into it.
β¨ NAME β¨
r.statistics β calculates category or object oriented statistics. yes she does math and yes she serves π
π KEYWORDS π
raster, statistics, zonal statistics
π SYNOPSIS π
r.statistics
r.statistics --help
r.statistics [-c] base=name cover=name method=string output=name
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π¦ Flags π¦
-cβ cover values are extracted from the category labels of the cover map. (iykyk, this is the glow-up flag β¨)--overwriteβ lets output files overwrite files that already exist. no cap, it will just do it.--helpβ prints the usage summary. your lil cheat sheet π--verboseβ verbose module output. she's chatty, we love her.--quietβ quiet module output. she's in her silent era.--uiβ forces launching the GUI dialog. clicky clicky mode π±οΈ
πΈ Parameters πΈ
base=name[required] β name of the base raster map. this is the main character πcover=name[required] β name of the cover raster map. the supporting role that's actually also iconic πmethod=string[required] β method of object-based statistic. options are:diversity,average,mode,median,avedev,stddev,variance,skewness,kurtosis,min,max,sumdiversity: diversity of values in specified objects in %% π¦average: average of values in specified objectsmode: mode of values in specified objectsmedian: median of values in specified objectsavedev: average deviation of values in specified objectsstddev: standard deviation of values in specified objectsvariance: variance of values in specified objectsskewness: skewnes of values in specified objects (yes, that's how the original spells it, and honestly? iconic typo, we don't fix, we preserve π )kurtosis: kurtosis of values in specified objectsmin: minimum of values in specified objectsmax: maximum of values in specified objectssum: sum of values in specified objects
output=name[required] β resultant raster map. the finished product, the final look, the reveal β¨
π DESCRIPTION π
r.statistics is a tool to analyse exploratory statistics of a categorical "cover layer" according to how it intersects with objects in a "base layer". a whole variety of standard statistical measures are possible (some GIS folks call these "zonal statistics"). all cells in the base layer count as one single object for the analysis. for some applications, you'll wanna prep the input data first so that all areas of contiguous cell category values in the base layer are uniquely identified β that's a job for r.clump, bestie.
the available methods are, in this exact order:
- average deviation
- average
- diversity
- kurtosis
- maximum
- median
- minimum
- mode
- skewness
- standard deviation
- sum
- variance
the calculations get performed on each area of data of the cover layers which fall within each unique value, or category, of the base layer. so like, per-object vibes. π§
setting the -c flag means the category labels of the covering raster layer will be used. this is genuinely nice because it dodges the GRASS limitation to integer in raster maps β by using category values, floating point numbers can be stored. not me being excited about floats π but fr fr, it's a big deal.
all calculations create an output layer. that output layer is a reclassified version of the base layer with identical category values, but modified category labels β the results of the calculations live in the category labels of the output layer. so the values don't move, the labels do. periodt. π
π₯ NOTES π₯
for floating-point cover map support, go check the alternative r.stats.zonal. π
for quantile calculations with support for floating-point cover maps, go check the alternative r.stats.quantile. π
β EXAMPLES β
calculation of average elevation of each field in the Spearfish region:
r.statistics base=fields cover=elevation.dem out=elevstats method=average
r.category elevstats
r.mapcalc "fieldelev = @elevstats"
r.univar fieldelev
look at her go. ate. π₯
π SEE ALSO π
r.category, r.clump, r.mode, r.mapcalc, r.neighbors, r.stats.quantile, r.stats.zonal, r.univar
π AUTHOR π
Martin Schroeder, Geographisches Institut Heidelberg, Germany
π SOURCE CODE π
Available at: r.statistics source code (history)
Accessed: Saturday Jan 17 05:41:00 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
ok that's the whole page bestie, no gatekeeping, every flag and every number stayed exactly where it was π«Ά
anyway, this was the GRASS GIS 8.4.2 Reference Manual β Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual, and the whole thing was last accessed Saturday Jan 17 05:41:00 2026. stay slaying, go run some zonal stats, and remember: the base layer is the main character but the cover layer is the plot twist. πβ¨π¦
π¦ 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