r.li.shape(1grass)

πŸ’– r.li.shape β€” the GRASS User's Manual glow-up πŸ’–

okay bestie, welcome to r.li.shape, section 1grass of the GRASS User's Manual 🌸 this lil guy is here to calculate the shape index on a raster map, and honestly? it ate. let's get into it 🫢


✨ NAME ✨

r.li.shape β€” calculates shape index on a raster map πŸ¦‹


πŸ”‘ KEYWORDS πŸ”‘

raster, landscape structure analysis, patch index β€” iykyk πŸ’…


πŸ“œ SYNOPSIS πŸ“œ

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

πŸŽ€ Flags

  • --overwrite β€” allow output files to overwrite existing files (yes, it will absolutely replace your old files, no cap)
  • --help β€” print usage summary
  • --verbose β€” verbose module output
  • --quiet β€” quiet module output
  • --ui β€” force launching GUI dialog

πŸ“ 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 like this, periodt:

LSI = 0.25 * E / sqrt(A)

with:

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

πŸ“ NOTES πŸ“

do NOT use absolute path names for the config and output file/map parameters. literally just don't, it's giving chaos πŸ’€

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

C:\Users\userxy\AppData\Roaming\GRASS8\r.li\output\

(that's the MS-Windows one bestie) or

$HOME/.grass8/r.li/output/

(that's GNU/Linux 🐧)

also!! if the input raster map contains only NULL values, then r.li.shape returns NULL. like, nothing, nada. sorry babe πŸ™ˆ


🧚 EXAMPLES 🧚

wanna calculate the shape index on map my_map, using the my_conf configuration file (that you previously defined with g.gui.rlisetup) and save results in my_out? run:

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

Forest map (Spearfish sample dataset) example, obsessed:

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, main character energy πŸ‘‘:

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)

Latest change: Friday Apr 17 01:04:26 2026 in commit: 32a143358df26b2e518b03c7e0d79541e8d1e5b1

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


and that's a wrap bestie 🫢 this was the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, and yeah β€” GRASS 8.5.0, r.li.shape(1grass), slay πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from