Update of the r.forestfrag addon for GRASS GIS

Some time ago I came across this post from Sylla Consult about a script to calculate forest fragmentation index suggested by Riitters et al. (2000). Obviously, it can be used for any land cover type, so perhaps landscape fragmentation index would be a better name. Anyway, the script r.forestfrag.sh is available from the GRASS-addons page.

Unfortunately, it only worked with GRASS 6.4. Because I mostly work in GRASS 7.0 I adapted the script to make it work on GRASS 7.0.  I also added some additional options and changes:

  • Added the option to select the size of the moving window (default is still 3×3)
  • Before the areas statistics (r.report) is run, the output map is trimmed to remove the edge effect of the calculations with the moving window. However, there is the option to keep the output map trimmed or not
  • Added the option to keep some of the intermediate layers (off by default).

I have added the new version of r.forestfrag.sh to https://svn.osgeo.org/grass/grass-addons/grass7/raster/r.forestfrag/ to make it easier for other to check / correct the script. The adapted version doesn’t run on GRASS 6.4 unfortunately, although it should be fairly easy to make it so.

r.forestfrag [raster, forest, fragmentation-index, Riitters]_001

r.forestfrag [raster, forest, fragmentation-index, Riitters]_002

Disclaimer: I only did some limited testing and on Linux only so I am not sure it will work on Windows.

About these ads

9 thoughts on “Update of the r.forestfrag addon for GRASS GIS

    1. pvanb Post author

      It is a simple index so should be easy enough for you. I haven’t ventured into the world of python yet, but would like to convert this shell script to a GRASS python script. Something for later (if ever).

      1. Curlew

        Hui, i just noticed that SAGA can also calculate the Riitters Fragmentation Index. The tool is under Grid – Analysis –> Fragmentation (Standard). It also works quite well in QGis via Sextante

  1. darkblue_b

    What does it mean ?

    “It was written for GRASS 6.4 and because of changes in the syntax of some of the functions used by the script, it won’t work in GRASS 7.0.”

    but then

    “It doesn’t run on GRASS 6.4 unfortunately, although it should be fairly easy to make it so.”

    1. pvanb Post author

      It means that the original version was written for GRASS 6.4. The adapted version only works on GRASS 7.0 (for now,I might make it compatible with 6.4 when time allows).

  2. maning

    Thanks for improving the script. I made the original GRASS script years ago. Glad to know other people are using it as well. Python versions (for QGIS and GRASS) should be easy to implement for those familiar with the language.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s