GRASS 7.0 is out, but the development continues unabated

Just a thumbs-up for the developers of GRASS GIS, who evidently do not rest on their laurels since their release of GRASS GIS 7.0. Below one of those more visible new features in the GRASS GIS development version which make live just that much easier.

nice new feature
A really welcome addition to the drop-down menu for selection of raster or vector layers. It now shows the open maps under a separate header.

A map with the number of mammal species based on IUCN redlist range maps

I am looking at species richness and number of threatened species across the landscape in eastern Africa and will explain briefly how you can create a map based on data from the IUCN Red List of Threatened Species spatial data set. From this site you can download expert validated range maps of species belonging to the taxonomic groups terrestrial mammals, reptiles and amphibians.

The maps are available as shapefiles. Not as one layer per species, but one (very) large shapefile that contains all the distribution maps of that group. If you don’t need it for the whole world, the first step you probably want to do is to clip the layer to your area of interest (there are various tools available in QGIS or you can do this from the command line using ogr2ogr.

If you import these shapefiles in GRASS GIS, they will be broken up into unique polygons. This is because GRASS GIS is a topological GIS as explained in more detail here, and therefore does not allow overlapping polygons. So, if you import the shapefile with terrestrial mammals for east Africa, you get something like this:

Vector distribution maps of the terrestrial mammals in east Africa from the IUCN red list
Vector distribution maps of the terrestrial mammals in east Africa from the IUCN red list

Already one can see some interesting patterns there, and the next step is to compute a map with the number of species. The number of species at any given location is of course the same as the number of overlapping polygons at that location. But how do we get that number? And didn’t I just wrote that there are no overlapping polygons in GRASS GIS?

First a little bit of background about how GRASS GIS handles vector layers and attribute tables. Each polygon (unique feature) will have one or more records in the attribute table. The map features (geometries) are linked to their attributes via what is called a Layer in GRASS GIS.

text5880As explained here, a vector layer can be linked to more than one attribute tables (note, it doesn’t need to be linked to a table), which is really neatly illustrated in Figure 1 on this page. If you import a vector layer with overlapping polygons, you will get a vector map with two layers. One that connects the polygons with the attribute table as explained above, and a layer 2 with categories that represent for each feature (polygon) the number of overlapping polygons in the original vector layer (with no linked to an attribute table).

This means GRASS is already doing automatically what I was asking for; counting the number species ( = number of overlapping polygons). Only, we don’t have those values in an attribute table so we cannot create a species-count map directly. The arguably easiest way is to convert the vector layer to a raster layer, whereby the raster values will be based on the values of Layer 2.

Convert the vector layer to a raster layer
Convert the vector layer to a raster layer. Use as source of raster values ‘cat’

You do this using the v.to.rast command, directly from the command line, or using the GUI like above (menu: vector: map type conversion: vector to raster). Make sure to select as source of raster values ‘cat’. And under the optional tab, select layer = 2 (layer number of name option).

Convert a vector to raster, using the cat value of layer 2
Convert a vector to raster, using the cat value of layer 2, which in this case represent the number of overlapping polygons in the original shapefile that we imported.

Next, select a nice colour palette for your raster layer and you’ll have your map depicting the number of species listed (and mapped) for the IUCN red list.

Count of terrestrial mammal species. Based on range maps from the IUCN red list.
Count of terrestrial mammal species. Based on range maps from the IUCN red list.

This is only a first step, and there is much more you can get out of this data. For example, you can combine the maps with information species current threat status, population size and species habitat preference; all available from the IUCN red list. See for example this nice blog post about Assessing habitat specialization using IUCN data.

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

Importing data in GRASS GIS – an example

Introduction

ISRIC, Earth Institute, Columbia University, World Agroforestry Centre (ICRAF) and the International Center for Tropical Agriculture (CIAT) have recently released a new data set of raster layers with various predicted soil properties. This data set is referred to as the “AfSoilGrids250m” data set. It supersedes the SoilGrids1km data set and comes at a resolution of 250 meter. The AfSoilGrids250m data (GeoTIFFs) are available for download under the Attribution 4.0 International (CC BY 4.0) license. See this page for download information.

In this post I’ll show you how you can import this data set in a GRASS GIS database. Continue reading Importing data in GRASS GIS – an example

GRASS GIS 7.0 is out!

It has taken many years of development, but finally the new stable major release GRASS GIS 7.0.0 is available. Many congratulations to the developers, they did an incredible job. This version provides numerous new functionalities, including completely new modules (e.g., the spatio-temporal database support) and massive improvements in data handling, with support for massive vector layers and speed improvements.

Check out the press release and the list of new features. But most of all, make sure you download the new version, if you have not done so already, and start enjoying a whole new experience.

GRASS GIS 7.0 RC2 ready for testing

The second release candidate of the upcoming stable GRASS GIS 7.0.0 version has been released. You can read the announcement here (including the download links) or the more detailed news about the release candidate here.

If you are still using GRASS 6.4, this long list of new features and improvements implemented in GRASS GIS 7 will give you plenty of reasons why you should try out the latest and greatest.

Update of r.forestfrag addon for GRASS GIS 7.0

Riitters et al. (2000) proposed a quick approach to measure the degree of forest fragmentation that could be relatively easily implemented and which only required a map with forest and non-forest. Following their approach, Sylla consult created a shell script for GRASS GIS 6.4 to create a raster layer with six categories (non-forest, patch, transitional, edge, perforated, interior and undetermined) as a measure of forest fragmentation. See their blog post with an explanation how the script works or the above-cited article for a more in-depth description.

I adapted the script to make it work on GRASS 7.0, including some further improvements, such as the option to select the size of the moving window, the option to trim the output layer to avoid the edge effect that comes with moving-window calculations and the option to keep intermediate layers.

I have now rewritten the script as a Python addon. See here for the manual page. Continue reading Update of r.forestfrag addon for GRASS GIS 7.0