If you find this document usefull, please consider ordering a printed hardcopy!



5 Map statistics

GRASS also offers built-in modules for calculating map statistics. In addition, a direct interface to the statistical software R exists for more complex geostatistic analysis (see bibliography).

Histograms and pixel distributions

Information about image histograms and image statistics are important for image improvement and image analysis (contrast adjustment, stretch) operations. Image histograms can be generated using the module d.histogram:

d.histogram rastermap

In the interactive mode the pixel distributions are represented in terms of bars. It is also possible to display the result as a pie chart.

The module r.stats is presents the pixel distribution as table. This module is very extensive with many application possibilities. Therefore, have a look at the help page before using this module. For instance multiple rastermaps can be queried simultaneously:

r.stats rastermap

The module r.report, which reverts to r.stats can conveniently be used in this context. This module is able to display interactively controlled pixel distribution, area analysis and so on as table. As an example a query of the landuse and geology is shown.

g.region rast=landuse -p
r.report -hen landuse,geology units=h
+---------------------------------------------------------------------+
|                      Category Information                |          |
|#|description                                             |  hectares|
|---------------------------------------------------------------------|
|1|residential                                             | 676.00000|
| |--------------------------------------------------------|----------|
| |1|metamorphic. . . . . . . . . . . . . . . . . . . . . .|  23.00000|
| |3|igneous. . . . . . . . . . . . . . . . . . . . . . . .|  18.00000|
| |4|sandstone. . . . . . . . . . . . . . . . . . . . . . .| 125.00000|
| |5|limestone. . . . . . . . . . . . . . . . . . . . . . .|  70.00000|
| |6|shale. . . . . . . . . . . . . . . . . . . . . . . . .| 125.00000|
| |7|sandy shale. . . . . . . . . . . . . . . . . . . . . .|  29.00000|
| |8|claysand . . . . . . . . . . . . . . . . . . . . . . .|  14.00000|
| |9|sand . . . . . . . . . . . . . . . . . . . . . . . . .| 272.00000|
|----------------------------------------------------------|----------|
|2|commercial and services                                 | 115.00000|
| |--------------------------------------------------------|----------|
| |1|metamorphic. . . . . . . . . . . . . . . . . . . . . .|  16.00000|
| |4|sandstone. . . . . . . . . . . . . . . . . . . . . . .|  19.00000|
[...]
|----------------------------------------------------------|----------|
|8|transportation and utilities                            | 400.00000|
| |--------------------------------------------------------|----------|
| |4|sandstone. . . . . . . . . . . . . . . . . . . . . . .|  34.00000|
| |5|limestone. . . . . . . . . . . . . . . . . . . . . . .|   8.00000|
| |6|shale. . . . . . . . . . . . . . . . . . . . . . . . .| 104.00000|
| |7|sandy shale. . . . . . . . . . . . . . . . . . . . . .|  26.00000|
| |8|claysand . . . . . . . . . . . . . . . . . . . . . . .|   4.00000|
| |9|sand . . . . . . . . . . . . . . . . . . . . . . . . .| 224.00000|
|---------------------------------------------------------------------|
|TOTAL                                                     |1519.00000|
+---------------------------------------------------------------------+

A display of univariate statistics values is possible via the module r.univar. This calculates the number of pixels and the minimum, maximum, arithmetical average, median, variance, standard deviation and variance coefficient of the map attribute based on the current region and raster resolution settings:

g.region rast=elevation.10m -p
r.univar -g elevation.10m
n=2654802
min=1061.06
max=1846.74
range=785.679
mean=1348.37
stddev=175.494
variance=30798.3
coeff_var=13.0153


If you find this document usefull, please consider ordering a printed hardcopy!


© 2005, GDF Hannover bR - Solutions for spatial data analysis and remote sensing
Last modified: 29-08-2005