Importing GLCF MODIS woody plant cover

The data set

The Global Land Cover Facility offers, amongst many other data sets, the MODIS Vegetation Continuous Fields data set for download. These are layers that contain proportional estimates for vegetative cover types (woody vegetation, herbaceous vegetation, and bare ground). As such they are very suitable depict areas of heterogeneous land cover.

Their MODIS products differ from DAAC editions by coming in GeoTIFF format, geographic coordinates, WGS84 datum, and a tiling system designed to fit well with Landsat imagery. Currently the collection 5 is available, which contains proportional estimates for woody cover vegetation for the years 2000 to 2010. It can be downloaded as tiles (195 in total) via a ftp server.

Below I’ll provide an example Continue reading “Importing GLCF MODIS woody plant cover”

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 “Access R from GRASS GIS on Windows”

A new search engine to search the R documentation

Just to quickly share this great new website where you can search the documentation of all R packages and functions available on CRAN (6688 R packages and 136342 R functions at the moment of writing!). It offers instant or advanced search options in an easy interface, and there is even a package that allows you to use the search functionality from within R. Check it out on

A new method and tool (ExDet) to evaluate novelty environmental conditions

A common objective of correlative species distribution model is to be able to project the potential distribution of the target species into a new environmental space. This can be a new geographic space (e.g., invasive species) or projected future conditions.

One should be very careful in interpreting results if extrapolating to areas with conditions that fall outside the range of reference environmental variation. There are several methods to visualize this uncertainty. On this blog I have for example mentioned the multi-environmental similarity tool in Maxent (also implemented in R in amongst others the dismo package and as an addon for GRASS GIS), which allows you to create maps that provides the similarity of each point to a set of reference points (Elith et al. 2010) and thus provide a quick overview of areas with ‘novel’ conditions.

A disadvantage of this and other methods is that they only consider the ranges of the individual predictors, and ignore the correlation structure of the covariates used to build the model. In reality, it is not unlikely that at a given locations values of each univariate factor fall within the original range of values, but the combination of environmental conditions is new. Continue reading “A new method and tool (ExDet) to evaluate novelty environmental conditions”

Import GRASS function console output as data.frame in R

In R you can use system calls or the spgrass6 package to run GRASS GIS functions. To do this, you need to run R from within GRASS GIS. This is as simple as starting GRASS GIS and subsequently starting R from the command line. See the GRASS-wiki for a more detailed background.

The issue at hand
One of the user-cases is when you want to (1) run a GRASS function on e.g., a raster layer and (2) capture the console output in a R data frame. For example, you can run the following in R:

MyVariables <- execGRASS("r.stats", flags="c", input="MyMap", separator=",", intern=TRUE)

However, the output is not in a very convenient format. Continue reading “Import GRASS function console output as data.frame in R”

Multivariate Environmental Similarity Surfaces (MESS) index in GRASS GIS

The Multivariate Environmental Similarity Surfaces (MESS) is an index that represents how similar a point in space 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, and is also available in the dismo package for R (see also here and here).

The latter works well on small and medium sized data sets. However, they take a long time to run on larger data sets, e.g., when working with 1km² raster grids covering eastern Africa. I therefore wrote a small R script to compute MESS in GRASS GIS. Continue reading “Multivariate Environmental Similarity Surfaces (MESS) index in GRASS GIS”

Reading GRASS GIS vector attribute tables into R

Linking GRASS GIS and R will give you a very powerful set of geo-spatial analytical tools. The spgrass6 offers a very convenient interface between GRASS GIS and R. You can read more about this package in Bivand, R. 2007. Using the R-GRASS interface. OSGeo Journal 1, 36-38.

Read the whole vector layer
It allows you amongst others to easily import vector data layers from GRASS GIS into R using the function readVECT6(). This will import the whole vector layer. But what if you you only need to import the attribute table? Importing the whole vector layer would give unnecessarily overhead and would take (much) longer to import. Continue reading “Reading GRASS GIS vector attribute tables into R”