r.li(1grass)
π r.li β bestie, welcome to the GRASS User's Manual entry for the landscape structure era π
okay so. this is r.li(1grass), straight out of the GRASS User's Manual, and it's not a normal manpage β it's the whole suite overview. grab a snack, we're doing multiscale landscape analysis. π¦
β¨ NAME β¨
r.li β Landscape structure analysis package overview
πΈ DESCRIPTION πΈ
The r.li suite is a toolset for multiscale analysis of landscape structure. Its whole goal? Implementing metrics as found in external software for quantitative measures of landscape structure, like FRAGSTATS (McGarigal and Marks 1995). no cap. π
The r.li suite offers a set of patch and diversity indices. It supports analysis of landscapes composed of a mosaic of patches, but β and this is the slay part β more generally, the modules work with any two-dimensional raster map whose cell values are integer (e.g., 1, 2) or floating point (e.g., 1.1, 3.2) values. icon behavior honestly.
The g.gui.rlisetup module has options for controlling the shape, size, number, and distribution of sampling areas used to collect information about the landscape structure. Sampling area shapes can be the entire map or a moving window of square, rectangular or circular shape. The size of sampling areas can be changed, so that the landscape can be analyzed at a variety of spatial scales simultaneously. Sampling areas may be distributed across the landscape in a random, systematic, or stratified-random manner, or as a moving window. pick your vibe β¨
The r.li modules can calculate a number of measures that produce single values as output (e.g. mean patch size in the sampling area), as well as measures that produce a distribution of values as output (e.g. frequency distribution of patch sizes in the sampling area). The results are stored as raster maps. πΊοΈ
All modules require a configuration file, which can be created by the g.gui.rlisetup module β a GUI tool providing a convenient way to set all necessary parameters. This file can be used repetitively, saving the user from the need to specify all parameters over and over again. bestie your future self says thank you π«Ά
π NOTES π
The general procedure to calculate an index from a raster map is two-fold:
- run
g.gui.rlisetup: create a configuration file selecting the parts of the raster map to be analyzed. This file lets you re-run an analysis easily. It is stored on Windows in the directoryC:\Users\userxy\AppData\Roaming\GRASS8\r.li\, and on GNU/Linux in$HOME/.grass8/r.li/. - run one or more of the
r.li.[index]modules (e.g.,r.li.patchdensity) to calculate the selected index using the areas selected in the configuration file.
yes that's literally it. two steps. the setup GUI does the heavy lifting and then you go index shopping. π₯
π EXAMPLES π
Let's calculate a patch density index on the entire 'geology' raster map in the Spearfish sample dataset, using a 5x5 moving window:
- CREATE A NEW CONFIGURATION FILE
1.1 run
g.gui.rlisetup
1.2 The main g.gui.rlisetup window is displayed, click on "New"
1.3 The new configuration window is now displayed, enter the configuration file name (e.g., "my_conf", do not use absolute paths)
Now the new configuration window is displayed.
Enter the configuration file name (e.g., "my_conf", do not use absolute paths) and the name of raster map (e.g., "geology").
The other fields are not needed for this configuration.
1.4 Click on "Setup sampling frame", select "Whole map layer" and click "OK"
1.5 Click on "Setup sampling areas", select "Moving window" and click "OK"
1.6 Click on "Use keyboard to enter moving window dimension"
1.7 Select "Rectangle" and enter 5 in the "height" and "width" fields
1.8 Click on "Save settings"
1.9 Close the g.gui.rlisetup window
- CALCULATE PATCHDENSITY INDEX
2.1 set the region settings to the "geology" raster map:
g.region raster=geology -p
2.2 run r.li.patchdensity:
r.li.patchdensity input=geology conf=my_conf out=patchdens
The resulting patch density is stored in the "patchdens" raster map. You can verify the result, for example, with contour lines:
r.contour in=patchdens out=patchdens step=5
d.rast patchdens
d.vect -c patchdens
note that if you want to run another index with the same area configuration, you don't have to create another configuration file. you can also use the same area configuration file on another map β the program rescales it automatically. for instance, if you have selected a5x5sample area on a100x100raster map, and you use the same configuration file on a200x200raster map, then the sample area is10x10. it's giving β¨ effortless scaling β¨
π SEE ALSO π
GUI tools:
g.gui.rlisetup: Configuration editor for ther.li.*module where*is the name of the index
Patch indices:
- Indices based on patch number:
r.li.patchdensity: Calculates patch density index on a raster map, using a 4 neighbour algorithmr.li.patchnum: Calculates patch number index on a raster map, using a 4 neighbour algorithm
- Indices based on patch dimension:
r.li.mps: Calculates mean patch size index on a raster map, using a 4 neighbour algorithmr.li.padcv: Calculates coefficient of variation of patch area on a raster mapr.li.padrange: Calculates range of patch area size on a raster mapr.li.padsd: Calculates standard deviation of patch area a raster map
- Indices based on patch shape:
r.li.shape: Calculates shape index on a raster map
- Indices based on patch edge:
r.li.edgedensity: Calculates edge density index on a raster map, using a 4 neighbour algorithm
- Indices based on patch attributes:
r.li.cwed: Calculates contrast Weighted Edge Density index on a raster mapr.li.mpa: Calculates mean pixel attribute index on a raster map
Diversity indices:
r.li.dominance: Calculates dominance diversity index on a raster mapr.li.pielou: Calculates Pielou eveness index on a raster mapr.li.renyi: Calculates Renyi entropy on a raster mapr.li.richness: Calculates richness diversity index on a raster mapr.li.shannon: Calculates Shannon diversity index on a raster mapr.li.simpson: Calculates Simpson diversity index on a raster map
Core library:
r.li.daemon: library with common functionality (not visible to the user)
π§ ADDING NEW INDICES π§
New indices can be defined and implemented by any C programmer, without having to deal with all the basic functions (IO etc.). The computing architecture and the functions are clearly separated, which allows for easy expandability. Every index is defined separately, placed in a directory along with its Makefile for compiling it and a file <module_name>.html which describes the index, including a simple example of use. See r.li.daemon for more information about development. go off, software engineer bestie π
β REFERENCES β
- McGarigal, K., and B. J. Marks. 1995. FRAGSTATS: spatial pattern analysis program for quantifying landscape structure. USDA For. Serv. Gen. Tech. Rep. PNW-351 (PDF).
- Baker, W.L. and Y. Cai. 1992. The r.le programs for multiscale analysis of landscape structure using the GRASS geographical information system. Landscape Ecology 7(4):291-302.
π AUTHORS π
Claudio Porta and Lucio Davide Spano, students of Computer Science, University of Pisa (Italy).
Commission from Faunalia Pontedera (PI)
Partially rewritten by Markus Metz
π SOURCE CODE π
Available at: r.li source code (history)
Latest change: Friday Apr 17 01:04:26 2026 in commit: 32a143358df26b2e518b03c7e0d79541e8d1e5b1
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
okay that's the whole thing, bestie β GRASS 8.5.0, last touched Friday Apr 17 01:04:26 2026 at commit 32a143358df26b2e518b03c7e0d79541e8d1e5b1, Β© 2003-2026 GRASS Development Team, from the GRASS 8.5.0 Reference Manual. now go set up your config file and slay some patches. periodt. πβ¨π
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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