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 overview
  • g.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