r.li.mps(1)
β¨ r.li.mps π
okay bestie, gather round, because this is the GRASS GIS User's Manual entry for r.li.mps and it's lowkey iconic π
πΈ NAME πΈ
r.li.mps β it calculates the mean patch size index on a raster map, and it does it using a 4 neighbour algorithm. no cap. that's the whole job. π
π¦ KEYWORDS π¦
raster, landscape structure analysis, patch index
β¨ SYNOPSIS β¨
r.li.mps
r.li.mps --help
r.li.mps input=name config=name output=name [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π Flags π
--overwriteβ lets your output files just go ahead and overwrite files that already exist. chaos mode, but consensual.--helpβ prints the usage summary. the classic "what does this do again" move.--verboseβ verbose module output. it will simply tell you more. π£οΈ--quietβ quiet module output. shhh. π€«--uiβ forces the GUI dialog to launch. main character energy, but graphical.
π Parameters π
input=name[required] β name of the input raster map.config=name[required] β the configuration file.output=name[required] β the name for the output raster map.
π DESCRIPTION π
so r.li.mps β that's mean patch size β figures out the mean size of the patches inside your sampling area, like this:
MPS = A / Npatch
where, bestie:
- A: the sampling area size, without the null cells.
- Npatch: the number of patches.
and the unit of that mean size? hectare. that's the vibe. πΎ
also important: this index is calculated using a 4 neighbour algorithm, which means diagonal cells are ignored when it's tracing a patch. diagonals simply don't get a say. periodt. π
π NOTES π
do NOT use absolute path names for the config and output file/map parameters. i'm serious. π
if you picked the "moving window" method back in g.gui.rlisetup, then your output is gonna be a raster map. otherwise you get an ASCII file generated in this folder:
C:\Users\userxy\AppData\Roaming\GRASS8\r.li\output\on MS-Windows$HOME/.grass8/r.li/output/on GNU/Linux
and one more thing β if the sample area contains only NULL value cells, then r.li.mps returns 0 (zero). it's not being rude, it's just the rules. π
π§ EXAMPLES π§
wanna calculate the mean path size index on map my_map, using the my_conf configuration file (which you already defined earlier with g.gui.rlisetup), and save the results in my_out? run this:
r.li.mps input=my_map conf=my_conf output=my_out
Forest map (Spearfish sample dataset) example β slay:
g.region raster=landcover.30m -p
r.mapcalc "forests = if(landcover.30m >= 41 && landcover.30m <= 43,1,null())"
r.li.mps input=forests conf=movwindow7 out=forests_mps_mov7
r.univar forests_mps_mov7
Forest map (North Carolina sample dataset) example β also slay:
g.region raster=landclass96 -p
r.mapcalc "forests = if(landclass96 == 5, 1, null() )"
r.li.mps input=forests conf=movwindow7 out=forests_mps_mov7
# verify
r.univar forests_mps_mov7
r.to.vect input=forests output=forests type=area
d.mon wx0
d.rast forests_mps_mov7
d.vect forests type=boundary
π SEE ALSO π
r.liβ package overviewg.gui.rlisetup
π 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)
π«Ά AUTHORS π«Ά
- Michael Shapiro - CERL (patch identification)
- Markus Metz (statistics)
β SOURCE CODE β
Available at: r.li.mps source code (history)
Accessed: Saturday Jan 17 05:40:53 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page, bestie π this was GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team, running on GRASS 8.4.2 β go forth and calculate those patches, you absolute legend πΈβ¨π
π¦ 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