Tips and Tricks

From GRASS-Wiki
Revision as of 02:18, 19 May 2006 by Dassau (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tips and Tricks

Using QGIS as a frontend to GRASS

QGIS can run as a frontend to GRASS. There is support for displaying maps, editing maps, and execution of simple GIS functions.

QGIS homepage: http://qgis.org

To use the two together, the GDAL-GRASS plugin must be installed.

GDAL homepage: http://www.gdal.org

Test that the GDAL-GRASS plugin is available with this command:

  gdalinfo --formats

Look for a line like "GRASS (ro): GRASS Database Rasters (5.7+)"

Enable the QGIS GRASS plugin from QGIS:

  GUI: Plugins / Plugin Manager / Check the GRASS checkbox

The GRASS toolbar should now be visible. While not a firm requirement, it is easier to start QGIS from within a GRASS session.

Related: How to compile/install [GrassQgisGdalOgrPlugin][GRASS and QGIS with GDAL/OGR Plugin]]

Exporting GRASS maps to GMT

GMT (Generic Mapping Tools) is a Free software package for creating publication quality cartography.

GMT homepage: http://gmt.soest.hawaii.edu

Exporting GRASS maps to GMT: http://169.237.35.250/~dylan/grass_user_group/ (Supplied by the GRASS Users Group of Davis, California)

Interfacing R-Statistics with GRASS

see: http://grass.ibiblio.org/statsgrass/index.php#grassR

R-Statistics homepage: http://www.r-project.org

(please expand)

Using GRASS with an on-line Web-GIS

see: http://grass.itc.it/start.html

UMN Mapserver homepage: http://mapserver.gis.umn.edu

(please expand)

Starting and running GRASS from a script

You have to set a couple of variables

  export GISBASE=/usr/local/grass60
  export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib
  export GISRC=$HOME/.grassrc6
  export GRASS_PNGFILE=/tmp/grass6output.png
  export GRASS_TRUECOLOR=TRUE
  export GRASS_WIDTH=900
  export GRASS_PNG_COMPRESSION=1
  export GIS_LOCK=$$

  #test:
  g.version

  #this should print the GRASS version used.

Then you can launch GRASS commands. This works within Shell scripts and also in the command line terminal.

Running GRASS remotely on OS X

Tiger (OS 10.4) changed the default configuration of SSH from previous versions of OS X. You can no longer start an ssh session with the -X flag and display the Tcl/Tk components of the GRASS GUI remotely. If you are running grass on OS X (10.4) between hosts on a network (i.e. running it on one machine but displaying it on another), you will need to use the "trusted forwarding" mode of SSH in order for the Tcl/Tk generated graphics, such as d.m or gis.m in order for the GUI graphics to make it through your connection. This can be done using the -Y flag when you start the ssh session:

ssh -Y remotehost

Using the -X flag, or simply turning on X11Forwarding in the SSH configuration files, is not enough: the symptoms in this case are that a d.mon window will function fine, but none of the Tcl/Tk dialogues will work, failing with an error message complaining either about Wish not behaving as expected, or a "Bad Atom".