r.li.shape(1)

πŸ’– r.li.shape β€” the shape index bestie πŸ’–

GRASS GIS User's Manual Β· section 1

okay so. you wanna know how shaped your patches are. no cap, this is the one. ✨


🌸 NAME 🌸

r.li.shape β€” calculates shape index on a raster map


πŸŽ€ KEYWORDS πŸŽ€

raster, landscape structure analysis, patch index


✨ SYNOPSIS ✨

r.li.shape
r.li.shape --help
r.li.shape input=name config=name output=name  [--overwrite]  [--help]
[--verbose] [--quiet] [--ui]

🫢 Flags

  • --overwrite β€” bestie, this lets your output files just bulldoze whatever was already there. allow output files to overwrite existing files πŸ’…
  • --help β€” prints the usage summary so you're not out here guessing
  • --verbose β€” verbose module output, i.e. it tells you everything it's doing
  • --quiet β€” quiet module output, i.e. it shuts up and just works
  • --ui β€” force launching the GUI dialog, for when you want the pretty buttons

🌈 Parameters

  • input=name [required] β€” name of input raster map
  • config=name [required] β€” configuration file
  • output=name [required] β€” name for output raster map

πŸ’œ DESCRIPTION πŸ’œ

r.li.shape calculates the landscape shape index, and the formula is literally this:

LSI = 0.25 * E / sqrt(A)

with:

  • E: sum of all edges
  • A: sum of all patch areas

that's it. that's the whole vibe. math ate. πŸ”₯


πŸ¦‹ NOTES πŸ¦‹

do NOT use absolute path names for the config and output file/map parameters. i'm so serious. relative paths only, bestie.

if the "moving window" method was selected in g.gui.rlisetup, then the output will be a raster map. otherwise an ASCII file will be generated in the folder:

  • C:\Users\userxy\AppData\Roaming\GRASS8\r.li\output\ (MS-Windows)
  • $HOME/.grass8/r.li/output/ (GNU/Linux)

and if the input raster map contains only NULL values, then r.li.shape returns NULL. it's giving "nothing to see here". πŸ«₯


πŸ“ EXAMPLES πŸ“

to calculate the shape index on map my_map, using the my_conf configuration file (previously defined with g.gui.rlisetup) and saving results in my_out, run:

r.li.shape input=my_map conf=my_conf output=my_out

forest map (Spearfish sample dataset) example β€” iconic dataset, no notes:

g.region raster=landcover.30m -p
r.mapcalc "forests = if(landcover.30m >= 41 && landcover.30m <= 43,1,null())"
r.li.shape input=forests conf=movwindow7 out=forests_shape_mov7
r.univar forests_shape_mov7

forest map (North Carolina sample dataset) example β€” the full glow-up, verification and all:

g.region raster=landclass96 -p
r.mapcalc "forests = if(landclass96 == 5, 1, null() )"
r.li.shape input=forests conf=movwindow7 out=forests_shape_mov7
# verify
r.univar forests_shape_mov7
r.to.vect input=forests output=forests type=area
d.mon wx0
d.rast forests_shape_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 πŸ’–

Claudio Porta and Lucio Davide Spano, students of Computer Science, University of Pisa (Italy).

Commission from Faunalia Pontedera (PI) (www.faunalia.it)


⭐ SOURCE CODE ⭐

Available at: r.li.shape source code (history)

Accessed: Saturday Jan 17 05:40:56 2026

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


Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


and that's the whole page, bestie πŸ’… this manual came to you courtesy of GRASS 8.4.2, and yeah β€” r.li.shape(1) is the section, periodt. go calculate some shapes. πŸ¦‹βœ¨

πŸ“¦ where this page comes from