r.stats.zonal1grass
Calculates category or object oriented statistics (accumulator-based statistics).
Usage
r.stats.zonal
r.stats.zonal --help
r.stats.zonal [-cr]
base=name
cover=name
method=string
output=name
[--overwrite]
[--help]
[--verbose]
[--quiet]
[--ui]
Keywords
raster, statistics, zonal statistics
Overview
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.
Notes
r.stats.zonal is intended to be a partial replacement for r.statistics, with support for floating-point cover maps at the expense of not supporting quantiles. For this, see r.stats.quantile.
Examples
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 areasr.stats.zonal base=zipcodes cover=elevation method=count output=zipcodes_elev_countr.colors zipcodes_elev_count color=gyr -g# average elevation in zipcode areasr.stats.zonal base=zipcodes cover=elevation method=average output=zipcodes_elev_avgr.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).
Source code
Available at: r.stats.zonal source code (history)
Accessed: Monday Feb 24 17:50:51 2025
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual
Releases
5 releases since Debian 9 (Stretch); the text changed 4 times.