GRASS and Pandas – from attribute table to pandas dataframe


In this post I show how to import an attribute table of a vector layer in a GRASS GIS database into a Pandas data frame. Pandas stands for Python Data Analysis Library which provides high-performance, easy-to-use data structures and data analysis tools for the Python programming language. For people familiar with R, the Pandas data frame is an object similar to the R data frame. They are a lot like the most common way in which spreadsheets are used, with the data presented in rectangular form with columns holding variables and rows holding observations. An important characteristic is that the data frame, like a spreadsheet, can hold different types of data in different columns: numbers, character data, dates and so on. Continue reading “GRASS and Pandas – from attribute table to pandas dataframe”


Importing data in GRASS GIS – an example


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 scripts to import data from Worldclim, CSFR and PISM

I just came across these GRASS GIS scripts by Julien Seguinot to import multiple files from the WorldClim current climate dataset, the  Climate Forecast System Reanalysis (CSFR) data and some other reanalysis data sets. Furthermore, there is a script ( to imports multiple raster maps from a NetCDF output file from PISM.

They are not in the GRASS addon 6 or GRASS addon 7 repositories so I am sharing the link here. If you are planning to work with these data sets, check out these scripts, they may make your life a whole lot easier.

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”

ESRI rasters in GRASS or QGIS

To exchange data one should preferably use a non-proprietary format, such as the ARC/INFO ASCII GRID or GeoTIFF. Unfortunately, it still happens that data is distributed in a proprietary binary format.

One of the most widely used ones is the binary ESRI ARC/INFO GRID. Of course if you have ArcView or ArcGIS you can use these to convert the ARC/INFO GRID to an ARC/INFO ASCII GRID. But what about the others?

Well, as it turns out, GDAL, which is used by GRASS GIS, QGIS and many other GIS software packages, can open the binary ESRI ARC/INFO grids also. All you have to know is where to find the actual raster file. Continue reading “ESRI rasters in GRASS or QGIS”