|
@@ -1,6 +1,17 @@
|
|
|
<!-- meta page description: Support for landscape index calculations on raster -->
|
|
|
<h2>DESCRIPTION</h2>
|
|
|
|
|
|
+This documentation is focused on scientists and developers who wants to
|
|
|
+implement a new landscape index computation. Refer to the
|
|
|
+<a href="r.li.html">r.li</a> modules overview and
|
|
|
+<a href="g.gui.rlisetup.html">g.gui.rlisetup</a> module for user-focused
|
|
|
+documentation.
|
|
|
+
|
|
|
+<p>
|
|
|
+<!--
|
|
|
+TODO: make this clear and rename daemon to library since it is library and not a daemon
|
|
|
+TODO: here can be just a really short intro and instructions how to get doxygen doc
|
|
|
+-->
|
|
|
<em>r.li.daemon</em> provides support for landscape index calculations on raster
|
|
|
maps. It hides the management of areas, defined using <a href="g.gui.rlisetup.html">g.gui.rlisetup</a>
|
|
|
command. It is not used like a standalone program, but its functions are
|
|
@@ -16,21 +27,23 @@ To write a new index only two steps are needed:
|
|
|
<li>
|
|
|
Define a function and insert its declaration on file <b>index.h</b> in <em>r.li.daemon</em>
|
|
|
folder, which contains all index declarations. This function must be of this kind:
|
|
|
- <br><div class="code"><pre>
|
|
|
+ <div class="code"><pre>
|
|
|
int index(int fd, char ** par, area_des ad, double * result)
|
|
|
- </pre></div><br>
|
|
|
+ </pre></div>
|
|
|
where: <ul>
|
|
|
<li><i>fd</i> is the raster map descriptor
|
|
|
<li><i>par</i> is a matrix for special parameter (like argv in main)
|
|
|
<li><i>ad</i> is the area descriptor
|
|
|
<li><i>result</i> is where to put the index calculation result
|
|
|
</ul>
|
|
|
- This function has to return 1 on success and 0 otherwise. <br><br>
|
|
|
+ This function has to return 1 on success and 0 otherwise.
|
|
|
+ This function type is defined using typedef named <code>rli_func</code>.
|
|
|
<li>
|
|
|
Create a main for command line arguments parsing, and call the function
|
|
|
- <br><div class="code"><pre>
|
|
|
- int calculateIndex(char * file, int f(int, char** area_des, double *), char **parameters, char *raster, char *output);
|
|
|
- </pre></div><br>
|
|
|
+ <div class="code"><pre>
|
|
|
+ int calculateIndex(char *file, rli_func *f,
|
|
|
+ char **parameters, char *raster, char *output);
|
|
|
+ </pre></div>
|
|
|
from the <i>r.li</i> library, for starting raster analysis.<br>
|
|
|
It follows the meaning of parameters:
|
|
|
<ul>
|
|
@@ -43,6 +56,10 @@ To write a new index only two steps are needed:
|
|
|
</ol>
|
|
|
Compile it using a changed Makefile based on the file for <em>r.li.patchdensity</em>.
|
|
|
|
|
|
+<p>
|
|
|
+Refer to the <i>r.li</i> library documentation in the source code and
|
|
|
+implementation of <i>r.li</i> modules for details and examples.
|
|
|
+
|
|
|
<h2>NOTES</h2>
|
|
|
|
|
|
Using GRASS library function to access raster rows can slow down moving windows
|