Home
Download
R/S-plus
What's new
Manual
Examples
Screenshots
Mailing lists
Qt GUI front end
Idrisi32 front end
PCRaster support
GRASS support
links
Known bugs

GRASS support in gstat

From version 2.3.3 on, gstat supports reading and writing of GRASS databases. Point data are read from site lists or raster maps, output is written to raster maps. Gstat 2.3.4 and later also support writing (prediction or simulation results) to site lists.

Mailing list

Grass has a mailing list, statgrass, which seems to be a useful platform for problems relating to grass, gstat and R. Please search the archives before you post.

What does it bring to grass?

Gstat is a program for modelling, prediction and simulation of geostatistical data. Gstat main features are:
  • variogram modelling: direct or cross variograms or covariograms
  • simple interpolation: neares neighbour, inverse distance, trend surfaces, spatial regression prediction
  • geostatistical interpolation: simple, ordinary and universal kriging or cokriging
  • geostatistical simulation: sequantial Gaussian (co-)simulation and sequantial indicator (co-)simulation.
For variogram modelling, gstat needs gnuplot to display variogram plots.

Which grass version?

Gstat versions up to 2.4.3 works with grass 5 data. Support for grass version 6.0 (beta1) is present in gstat version 2.4.4. The change is related to the fact that grass 6 no longer supports site_lists, but has point data in a vector structure. Use the grass command v.in.sites to convert site_lists to vector.

Version 5.4 introduced dynamic libraries instead of static libraries. This poses some problems to configuring gstat. Read this message for solutions.

When is GRASS support enabled?

First, you need to have a gstat version that has grass support compiled in it. If you type
gstat -v
you will get output like:
compiled on:          Apr 23 2001
with libraries:       csf gd (gif) grass gsl ncurses netcdf
last modified on:     Thu Mar  8 13:30:45 CET 2001
gstat home page:      http://www.gstat.org/
questions, bugs etc.  mailto:gstat-info@geog.uu.nl
 
gstat: Linux version 2.3.3 (08 March 2001)
Copyright (C) 1992, 2000 Edzer J. Pebesma
Updates, manuals and source code: http://www.gstat.org/
usage: gstat [options] [file]
gstat: no command file
Note that the second line mentions grass. If it doesn't, you don't have a suitable gstat version.

Second, you need to run gstat from the GRASS prompt. If you run it from any shell prompt, the GRASS library cannot locate its database. Technically, gstat checks whether the environment variables LOCATION, GISDBASE and MAPSET were set, and if they are set, it will try to read and/or write data from and to the GRASS database.

Support for regions

When a region is set in GRASS, gstat will only interpolate or simulate the raster cells in the region. If the flag "region" is set in a data definition, such as
data(zinc): "zinc.sites", region;
then gstat will only consider data locations within the region for interpolation. With no region keyword in the gstat data definition (default) gstat will consider all sites for the interpolation.

How to compile grass support?

When grass5 is installed in /usr/local/grass5, start the configure script with
./configure --with-grass

When grass5 is installed in another directory called PATH, start the configure script with

./configure --with-grass=PATH
where PATH is the full (not relative) path to the grass5 directory.

In this PATH, gstat needs to find the the directories lib and include. In the lib directory it needs to find libgis.a and libdatetime.a. In the include directory it needs to find the file gis.h. Configure does not check for these files. As all GRASS applications, gstat with grass support needs libz to be installed.

More information

Other links of statistics/geostatistics programs to GRASS are found on the stats/grass pages and mailing list.
Last modified: March 16, 2005
Page contents by Edzer J. Pebesma, page layout by Kor de Jong. Send comments.