Open source tools

open source
grass gis
Programs like R and GRASS GIS are incredible powerful. But occasionally, you’ll need a functionality that is not available yet. Luckily, depending on the kind of functionality, it isn’t terribly difficult to create your own scripts. In the past years I have created a few scripts that, I hope, are useful to others as well.

Paulo van Breugel


June 11, 2020


Most of the tools I use are open source. In part because I believe that the use of open-source software and open data contributes towards a more transparent, rapid and inclusive science, especially in ecology, biogeography, and conservation sciences. But also because open-source tools such as R, GRASS GIS and QGIS are among the best tools available today. And thanks to the extensive documentation and the remarkable support offered by the developer and user communities, it is possible to relatively quickly build simple tools yourself. I have created a few tools in the past years, which I am glad to share below.

GRASS addons

The GRASS addons I have created or contributed to are listed below. For installation you should preferably use the extension manager (g.extention or via GUI). If that doesn’t work, see the download link (and see here for installation instructions). For the full list of addons available for GRASS GIS, see here.


A GRASS GIS addon to compute multivariate environmental similarity surface (MES). This represents how similar a point is to a reference set of points, with respect to a set of predictor variables. Some additional supporting layers are created as well. Manual page


Computation of the multivariate environmental bias, which compares the medium environmental conditions in an area (e.g., a country) to those in a subset of that area N (e.g., the protected areas in that country). It thus provides a measure to estimate how well conditions in the subset of an area represents conditions in the whole area, or the other way around, how biased the distribution of the subset is in environmental space. Manual page


Detection and quantification of novel uni- and multi-variate environments following methods developed by Mesgaran et al. (2014). Manual page


Computes diversity indices based on 2 or more input layers representing species (or other categories being used). Indices currently implemented are the Renyi entropy index and a number of specialized cases of the Renyi entropy, viz.the species richness, the Shannon index, the Shannon based effective number of species (ENS), the Simpson index (inverse and Gini variants), and Pielou’s evenness. Manual page


The function computes two metrics to quantify niche similarity or overlap between all pairs of input raster layers: (D) the niche equivalency or similarity for two species following Warren et al. (2009) based on Schoener’s D (Schoener, 1968). Manual page


Function to compute the variance inflation factor (VIF) and the square root of the VIF. The variable with the highest VIF will be dropped and the VIF will be recomputed. This will be repeated until a user-defined VIF threshold value is reached. Manual page


The addon makes it easy to draw a boxplot of raster values, or pass a zonal raster layer and get per class boxplots. Manual


The r.seriesboxplot addon draws boxplots of series of input raster layers. It can be used to display both temporal patterns and spatial variation. Manual


Te t.rast.boxplot addon draws boxplots of the raster in a space-time raster data set (strds). The module can be used to display changes over time, and how this varies within a area. Manual


.vect.colbp draws a boxplot of the values in a vector map attribute column. There is also the option to group the values of the column according to the categories in a second column (group_by and create one plot with for each group a separate boxplot. Manual


Create and export image file with legend of a raster map.Manual page


Generates a raster layer with a weighted random selection of the raster cells (selected cells are assigned a value 1, other a value 0) based on a user-defined weight raster layer. Manual page


Reclass/recode a raster layer based on values in a CSV table. Manual page


GRASS GIS addon to uploads raster values and labels at positions of vector points to the vector attribute table. Manual page


Export categories and corresponding colors as QGIS color file or CSV file. Non-existing categories and their color definitions will be removed. Manual page


Export raster values at given point locations as text file in SWD format for input in Maxent. Manual page


Evaluate how well a modeled probability distribution predicts an observed distribution using all or restricted set of background / absence points. Runs a R script in the background, so R needs to be installed manual page

R/GRASS scripts

Combining the power of GRASS GIS, which excels in handling and analysis of spatial data, and the vast number of functions for (spatial) data visualization and analysis in R (see R Spatial View) and you have a winner at hand. Below, an example of a R script that garners the strength of both tools. It uses GRASS GIS in the background for the data crunching and R for the graphical output.


R function to create a response plot to evaluate the relationship between environmental variables and the fitted probability of occurrence of individual or ensemble suitability modelling algorithms. on GitHub

GIS styles

Spatial data layers often come with standard legend / color keys, which provides the visualization and even meaning to the data. As a side note, try to avoid the latter! Unfortunately, they are often shared in proprietary format which cannot be used in other programs and are not human-readable. To avoid vendor lock in and to enable everybody to use it is therefore preferable to share color and legend keys in an open format that is also human-readable (i.e., text-based files). See this GitHub page for some examples.

ZIM-wiki export templates

Zim-wiki is a graphical text editor for notes in the form of wiki pages. A great feature of Zim-wiki is that you can easily export the notebook (or part of it) as a website. You can thereby use export templates to determine how the webpages will look like. Below you can find export templates that you can use for your own websites.


Template to export your Zim notebook as a responsive/adaptive website that can be viewed in desktop and mobile devices alike. We use this template ourself for the Vegetationmap4africa website and for our tutorials.GitHub page


Template to export your Zim notebook as a website with mobile theme. Build with jquerymobile to create a website with a focus on mobile devices, but which will also look good on the desktop. The template offers some pointers to customize the design to fit the user’s need. GitHub page