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.
Disclaimer: I only did some limited testing and on Linux only so I am not sure it will work on Windows.