r.li.daemon.html 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>r.li</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <link rel="stylesheet" href="grassdocs.css" type="text/css">
  7. </head>
  8. <body bgcolor="white">
  9. <img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
  10. <h2>NAME</h2>
  11. <em><b>libgrass_rli</b></em> - r.li landscape index support library
  12. <h2>DESCRIPTION</h2>
  13. <em>r.li.daemon</em> provides support for landscape index calculations on raster
  14. maps. It hides the managment of areas, defined using <a href="r.li.setup.html">r.li.setup</a>
  15. command. It is not used like a standalone program, but its functions are
  16. a library used by all <em>r.li.[index]</em> commands.<br>
  17. This description is a tutorial for new index definition. <br><br>
  18. The developer has only to focus on a unique area, like in mathematical definitions, and
  19. has to write a C implementation of it.<br>
  20. The areas are defined using a <em>struct</em> called <b>area_des</b> and it members are
  21. explained in the source code (doxygen) documentation.
  22. <p>
  23. To write a new index only two steps are needed:
  24. <ol>
  25. <li>
  26. Define a function and insert its declaration on file <b>index.h</b> in <em>r.li.daemon</em>
  27. folder, which contains all index declarations. This function must be of this kind:
  28. <br><div class="code"><pre>
  29. int index(int fd, char ** par, area_des ad, double * result)
  30. </pre></div><br>
  31. where: <ul>
  32. <li><i>fd</i> is the raster map descriptor
  33. <li><i>par</i> is a matrix for special parameter (like argv in main)
  34. <li><i>ad</i> is the area descriptor
  35. <li><i>result</i> is where to put the index calculation result
  36. </ul>
  37. This function has to return 1 on success and 0 otherwise. <br><br>
  38. <li>
  39. Create a main for command line arguments parsing, and call the function
  40. <br><div class="code"><pre>
  41. int calculateIndex(char * file, int f(int, char** area_des, double *), char **parameters, char *raster, char *output);
  42. </pre></div><br>
  43. from the <i>r.li</i> library, for starting raster analysis.<br>
  44. It follows the meaning of parameters:
  45. <ul>
  46. <li><i>file</i> name of configuration file created using <a href="r.li.setup.html">r.li.setup</a>
  47. <li><i>f</i> pointer to index function defined above
  48. <li><i>parameters</i> pointer to index special parameters
  49. <li><i>raster</i> name of raster to use
  50. <li><i>output</i> output file name
  51. </ul>
  52. </ol>
  53. Compile it using a changed Makefile based on the file for <em>r.li.patchdensity</em>.
  54. <h2>NOTES</h2>
  55. Using GRASS library function to access raster rows can slow down moving windows
  56. execution. It is recommended to use
  57. <br><div class="code"><pre>
  58. RLI_get_cell_row(int, int, area_des)
  59. RLI_get_fcell_row(int, int, area_des)
  60. RLI_get_dcell_row(int, int, area_des)
  61. </pre></div><br>
  62. to use an ad hoc build memory managment developed to speed up the system.
  63. The documentation is in doxygen files.
  64. <h2>SEE ALSO</h2>
  65. <em><a href="http://grass.osgeo.org/gdp/landscape/r_le_manual5.pdf">old r.le manual</A></em><br>
  66. <em><a href="r.li.html">r.li</A></em> package overview <br>
  67. <em><a href="r.li.patchdensity.html">r.li.patchdensity</A></em>,
  68. <em><a href="r.li.setup.html">r.li.setup</A></em>
  69. <h2>AUTHORS</h2>
  70. Claudio Porta and Lucio Davide Spano, students of Computer Science
  71. University of Pisa (Italy).<br>
  72. Commission from Faunalia Pontedera (PI)<br>
  73. Rebuild of r.le.setup from William L. Baker
  74. This program is free software under the GPL (>=v2)
  75. Read the COPYING file that comes with GRASS for details.
  76. <p>
  77. <i>Last changed: $Date$</i>
  78. <HR>
  79. <p><a href="index.html">Main index</a> - <a href="raster.html">raster index</a> - <a href="full_index.html">Full index</a>
  80. </body>
  81. </html>