Author Archives: pvanb

About pvanb

I am a tropical forest ecologist with a focus on spatial and temporal patterns and processes at population and ecosystem level. I am furthermore very interested in issues related to conservation and sustainable use of biodiversity and natural resources under current and future climates. I have worked in the Middle East (Syria and Lebanon) and South America (Brazil) and in Eastern Africa (Kenya).

Access R from GRASS GIS on Windows

Since I have switch from Windows to Linux, many years ago, things have started to look a lot brighter for those wanting to use GRASS on Windows. I won’t switch back to Windows any time soon, but I recently had to install WinGRASS for somebody else. And it was a whole lot easier than I had feared (or even hoped).

But there is one thing I couldn’t immediately figure out; how to run R from within GRASS. I should add that I installed GRASS using the OSGEO4W installer. When installing GRASS using the stand alone installer, access to R from the GRASS command line should work out-of-the-box (see comment from Helmut in the comment section below).

After a bit of trial and error, I came up with the steps below. It involves editing a file to tell GRASS where to look for executables. In the example below I am adding the path to the R and rstudio executables to this file. Having done that, I can now type R.exe or rstudio.exe on the GRASS command line to open these programs. Continue reading

Recode your raster file in GRASS GIS using a csv file

The two easiest ways to reclassify a raster layer in GRASS GIS are using the r.reclass or r.recode functions. Although both are easy enough to use, sometimes it would be nice if you could just provide the input layer and a simple table with re-class values to create new raster maps. A fairly trivial task, so ideal to make another attempt at creating a python script.

I create a small add-on (r.recode.attr) that let you reclass/recode a raster layer based on values in a csv (comma separated text) file. The csv file should include one column with the raster values and one or more columns with the reclassification values. For each of these columns a new map will be created.  See the manual page for more information. Continue reading

Online data sources: Harvest choice

One example of of spatial data on the web every week… this week Harvest choice

Harvest Choice

Description: Harvest Choice is a collaboration between various partners that aim to build decision support databases, analytical tools, and knowledge delivery mechanisms to promote evidence-based decisions regarding agricultural investment and intervention options. It does this by providing information on a list of crop and livestock commodities. Continue reading

Online data sources: the Atlas of African Agriculture Research & Development

Data source of the week

There is a wealth of information on e.g., land use, climate and species available online. But you need to know where to look. My plan is to highlight one example every week (let’s see if I can keep up with that). You’ll find more examples on

Atlas of African Agriculture Research & Development

Description: The e-atlas is a repository of data useful for agriculture research and development in Africa. It provides online, open-access to spatial data and tools that is generated and maintained by a community of research scientists, development analysts, and practitioners working in and for Africa. The e-Atlas highlights the ubiquitous nature of smallholder agriculture in Africa and provides data needed to describe the many factors shaping the location, nature, and performance of agricultural enterprises and the strong interdependencies among farming, natural resource stocks and flows, rural infrastructure, and the well-being of the poor. Continue reading

Computing MESS in R and GRASS – a speed comparison

The Multivariate Environmental Similarity Surfaces (MESS) is an index that represents how similar a point is to a reference set of points, with respect to a set of predictor variables (Elith et al (2010). The function was first implemented as part of the Maxent software package, but is now also available in R and GRASS. Below, I will compare how fast the different implementations are. Continue reading

Access GRASS 7 data in QGIS

QGIS supports GRASS in two different ways. 1) For those working with GRASS databases, there is the GRASS toolbox, which basically offered an alternative GUI to GRASS. For those working with other data types, most GRASS functions are now available through the processing toolbox.

I do most of my spatial analysis in GRASS, while I use QGIS amongst others to create maps based on the results. So I mostly used the GRASS toolbox. Unfortunately, the GRASS toolbox doesn’t work (yet) in QGIS 2.6. So what now? Well, as it turns out, QGIS can access GRASS raster layers through the QGIS browser. Continue reading