.TH r.li.daemon 1grass "" "GRASS 8.3.2" "GRASS GIS User's Manual" .SH Support for landscape index calculations on raster .SH DESCRIPTION This documentation is focused on scientists and developers who wants to implement a new landscape index computation. Refer to the r.li modules overview and g.gui.rlisetup module for user\-focused documentation. .PP \fIr.li.daemon\fR provides support for landscape index calculations on raster maps. It hides the management of areas, defined using g.gui.rlisetup command. It is not used like a standalone program, but its functions are a library used by all \fIr.li.[index]\fR commands. .br This description is a tutorial for new index definition. .br .br The developer has only to focus on a unique area, like in mathematical definitions, and has to write a C implementation of it. .br The areas are defined using a \fIstruct\fR called \fBarea_des\fR and it members are explained in the source code (doxygen) documentation. .PP To write a new index only two steps are needed: .IP .IP \fB1\fR Define a function and insert its declaration on file \fBindex.h\fR in \fIr.li.daemon\fR folder, which contains all index declarations. This function must be of this kind: .br .nf \fC int index(int fd, char ** par, area_des ad, double * result) \fR .fi where: .RS 4n .IP \(bu 4n \fIfd\fR is the raster map descriptor .IP \(bu 4n \fIpar\fR is a matrix for special parameter (like argv in main) .IP \(bu 4n \fIad\fR is the area descriptor .IP \(bu 4n \fIresult\fR is where to put the index calculation result .RE This function has to return 1 on success and 0 otherwise. This function type is defined using typedef named \fCrli_func\fR. .IP \fB2\fR Create a main for command line arguments parsing, and call the function .br .nf \fC int calculateIndex(char *file, rli_func *f, char **parameters, char *raster, char *output); \fR .fi from the \fIr.li\fR library, for starting raster analysis. .br It follows the meaning of parameters: .RS 4n .IP \(bu 4n \fIfile\fR name of configuration file created using g.gui.rlisetup .IP \(bu 4n \fIf\fR pointer to index function defined above .IP \(bu 4n \fIparameters\fR pointer to index special parameters .IP \(bu 4n \fIraster\fR name of raster to use .IP \(bu 4n \fIoutput\fR output file name .RE .PP Compile it using a changed Makefile based on the file for \fIr.li.patchdensity\fR. .PP Refer to the \fIr.li\fR library documentation in the source code and implementation of \fIr.li\fR modules for details and examples. .SH NOTES Using GRASS library function to access raster rows can slow down moving windows execution. It is recommended to use .br .br .nf \fC RLI_get_cell_row(int, int, area_des) RLI_get_fcell_row(int, int, area_des) RLI_get_dcell_row(int, int, area_des) \fR .fi .br to use an ad hoc build memory management developed to speed up the system. The documentation is in doxygen files. .SH SEE ALSO \fIold r.le manual\fR .br \fIr.li\fR \- package overview .br \fIg.gui.rlisetup\fR .SH 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) .SH AUTHORS Claudio Porta and Lucio Davide Spano, students of Computer Science University of Pisa (Italy). .br Commission from Faunalia Pontedera (PI) .br Rewritten from \(dqr.le.setup\(dq by William L. Baker .br Various bug fixes by Markus Metz .SH SOURCE CODE .PP Available at: Support for landscape index calculations on raster source code (history) .PP Accessed: Friday Mar 08 07:34:31 2024 .PP Main index | Topics index | Keywords index | Graphical index | Full index .PP © 2003\-2024 GRASS Development Team, GRASS GIS 8.3.2 Reference Manual