r.li.daemon(1grass)

πŸ’– r.li.daemon β€” bestie edition πŸ’–

Support for landscape index calculations on raster ✨ (yes that's the whole name, no notes, it just is that)


πŸŽ€ DESCRIPTION πŸŽ€

Okay so listen. This page is specifically for scientists and developers who wanna implement a brand new landscape index computation. If you're just here to use stuff, you want the r.li modules overview and the g.gui.rlisetup module instead β€” those are the user-facing docs, this one is the builder's manual, iykyk.

r.li.daemon is out here providing support for landscape index calculations on raster maps. What it does is it hides all the management of areas, which get defined using the g.gui.rlisetup command. And no, you don't run it like a standalone program bestie β€” its functions are a library that all the r.li.[index] commands use. Not me explaining a daemon that's actually a library, the lore is the lore πŸ™ˆ

This description right here? It's a tutorial for new index definition 🌈 The dev only has to focus on one unique area, exactly like in mathematical definitions, and then write a C implementation of it. Chef's kiss.

The areas are defined using a struct called area_des, and its members are explained in the source code (doxygen) documentation. Go read it, it's giving documentation energy πŸ’…

To write a new index, literally only two steps are needed:

  1. Define a function and insert its declaration on file index.h in the r.li.daemon folder, which contains all index declarations. Obsessed with how tidy that is. This function must be of this kind:
int index(int fd, char ** par, area_des ad, double * result)

where:

  • fd is the raster map descriptor 🌸
  • par is a matrix for special parameter (like argv in main) πŸ¦‹
  • ad is the area descriptor ✨
  • result is where to put the index calculation result πŸ’–

This function has to return 1 on success and 0 otherwise. And this function type is defined using a typedef named rli_func. Slay.

  1. Create a main for command line arguments parsing, and call the function
int calculateIndex(char *file, rli_func *f,
                   char **parameters, char *raster, char *output);

from the r.li library, for starting raster analysis. Bestie that's the whole ritual, no cap. It follows the meaning of parameters:

  • file β€” name of configuration file created using g.gui.rlisetup πŸŽ€
  • f β€” pointer to index function defined above πŸ”₯
  • parameters β€” pointer to index special parameters πŸ’œ
  • raster β€” name of raster to use 🌈
  • output β€” output file name ⭐

Compile it using a changed Makefile based on the file for r.li.patchdensity. Copy the vibe, change the vibe, you know how it goes.

Refer to the r.li library documentation in the source code and implementation of r.li modules for details and examples. Everything you need is in there fr fr.


πŸ‘‘ NOTES πŸ‘‘

Real talk: using GRASS library function to access raster rows can slow down moving windows execution. That's the tea, and it's not the good kind of tea 😭

It is recommended to use:

RLI_get_cell_row(int, int, area_des)
RLI_get_fcell_row(int, int, area_des)
RLI_get_dcell_row(int, int, area_des)

because these use an ad hoc build memory management developed to speed up the system. Main character optimisation energy honestly. The documentation for them is in doxygen files. Go, read, thrive πŸ’…


πŸ¦‹ SEE ALSO πŸ¦‹

  • old r.le manual
  • 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)

(citation icon behaviour, we love an academic moment πŸŽ“)


πŸ’œ AUTHORS πŸ’œ

  • Claudio Porta and Lucio Davide Spano, students of Computer Science University of Pisa (Italy). πŸŽ“
  • Commission from Faunalia Pontedera (PI)
  • Rewritten from "r.le.setup" by William L. Baker
  • Various bug fixes by Markus Metz πŸ”§

⭐ SOURCE CODE ⭐

Available at: Support for landscape index calculations on raster source code (history)

Accessed: Tuesday Sep 08 11:54:21 2026

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


Okay that's the whole page bestie, you ate it. πŸ’…βœ¨

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β€” and shoutout to GRASS 8.5.0 + r.li.daemon(1grass) sitting in the footer, and yeah the access date was Tuesday Sep 08 11:54:21 2026, we're time travellers now πŸ¦‹ Byeee, go write that index function, it's giving genius πŸ™ˆπŸ’–

πŸ“¦ where this page comes from