GRASS logo


r.pi.index - Basic patch based indices


raster, landscape structure analysis, fragmentation analysis


r.pi.index --help
r.pi.index [-a] input=name output=name keyval=integer method=string [title="phrase"] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Set for 8 cell-neighbors. 4 cell-neighbors are default
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


input=name [required]
Raster map containing categories
output=name [required]
Output patch-based result as raster map
keyval=integer [required]
The value of the class to be analysed
method=string [required]
Operation to perform on fragments
Options: area, perimeter, shape, border, compactness, asymmetry, area-perimeter, fractal, ENN
Title for resultant raster map

Table of contents


r.pi.index is a patch based fragmentation analysis package. Computation of basic fragmentation indices can be accomplished.

Available options for the index to be computed for patches within a certain class are: area (area), perimeter (perim), SHAPE (shape), Border-Index (bor), Compactness (comp), Asymmetry (asym), area-perimeter ratio (apr), fractal dimension (fract), distance to euclidean nearest neighbour (ENN).


The Nearest Neighbour Index (ENN) analyse the Euclidean Nearest Neighbour to the first neighbouring patch. The output value is in pixel and can be converted to a distance values using g.region resolution information. r.pi.enn and r.pi.fnn provide the same analysis concerning the first nearest neighbour (NN), but are extended to the n-th NN. However due to code construction does the r.pi.index distance analysis to first ENN perform faster. Methods: The method operators determine what algorithm is applied on the patches. r.pi.index can perform the following operations:

The Area computes the area of each patch.
The Perimeter computes the perimeter of each patch.
Area-Perimeter ratio
The Area-Perimeter ratio divides the patch perimeter by the area.
The SHAPE Index divides the patch perimete by the minimum perimeter possible for a maximally compact patch of the corresponding patch area.
Border Index
The Border Index ....
Compactness Index
The Compactness Index ....
Asymmetry Index
The Border Index ....
Fractal Dimension Index
The Fractal Dimension Index ....
Nearest Neighbour Index
The Nearest Neighbour Index computes the Euclidean distance to the first nearest neighbour patch.


Examples based on the North Carolina sample dataset are provided below. Indices are calculated for the landscape class 5 (forest). set region settings to used landcover class map:
g.region rast=landclass96
computation of patch size (patch definition: 4-neighbourhood rule)
r.pi.index input=landclass96 output=landclass96_forestclass5_area keyval=5 method=area
# improve colouring of resulting map:
r.colors landclass96_forestclass5_area col=bgyr
computation of patch size (patch definition: 8-neighbourhood rule)
r.pi.index input=landclass96 output=landclass96_forestclass5_area keyval=5 method=area -a
computation of patch isolation (euclidean distance to 1. nearest neighbour; patch definition: 4-neighbourhood rule)
r.pi.index input=landclass96 output=landclass96_forestclass5_ENN keyval=5 method=ENN -a


r.pi.enn, r.pi.import, r.pi.rectangle, r.pi


Landscapes with more than 10 000 individual patches might cause a memory allocation error depending on the user's system.


Programming: Elshad Shirinov
Scientific concept: Dr. Martin Wegmann
Department of Remote Sensing
Remote Sensing and Biodiversity Unit
University of Wuerzburg, Germany

Port to GRASS GIS 7: Markus Metz


Available at: r.pi.index source code (history)

Latest change: Tuesday Sep 19 09:59:22 2023 in commit: e76c325998c8cd9053ce012a5adbb79f33ab0779

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.3dev Reference Manual