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:
- Define a function and insert its declaration on file
index.hin ther.li.daemonfolder, 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:
fdis the raster map descriptor πΈparis a matrix for special parameter (likeargvinmain) π¦adis the area descriptor β¨resultis 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.
- Create a
mainfor 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 usingg.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.lemanual 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)
(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
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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