Tips and Tricks

From GRASS-Wiki
Revision as of 23:38, 27 September 2012 by ⚠️Marcocurreli (talk | contribs) (→‎Tips and Tricks: quick tips: checking categories pertainig to more than one feature)
Jump to navigation Jump to search

Tips and Tricks

Using QGIS as a frontend to GRASS

  • QGIS started as a simple viewer for geodata. And that's really what it still is: a simple-to-use geodata viewer with some editing capabilities. That's what it was designed to be and that's what it can do really well. QGIS does not have built-in capabilities for geodata processing and analysis.
However, a while back, Radim Blazek, who was then a core developer of the GRASS 6 system, decided to write a plugin for QGIS that would make it possible to access GRASS functionality from within the QGIS GUI.
And that's what you get today, when you download a binary version of QGIS for your platform: QGIS + GRASS 6 plus a plugin that makes using GRASS from QGIS simple and fun.


QGIS can run as a frontend to GRASS. There is support for displaying maps, editing maps, and execution of simple GIS functions. The GDAL/OGR library is a requirement for that (but for GRASS anyway):

Here is a nice tutorial for editing vectors using QGIS as a frontend to GRASS: Editing_GRASS_vectors_with_QGIS (where did it go? unported from old wiki site? )

To use GDAL and GRASS together, the GDAL-GRASS plugin must be installed:

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.

Importing SRTM30plus data

See Global datasets page

GMT (The Generic Mapping Tools)

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

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

Interfacing R-Statistics with GRASS

GRASS may be combined with R-Statistics to create a very powerful geostatistical analysis platform.

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

Using GRASS with an on-line Web-GIS

see:

(please expand)

Starting and running GRASS from a script

See GRASS and Shell.

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

or add this to ~/.ssh/config:

Host hostname
  ForwardX11 yes
  ForwardX11Trusted yes

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".

Quick tips

Checking categories pertainig to more than one feature

v.build op=cdump map=mymap | gawk -F"|" '{print $1}' | uniq -dc

returns, e.g.
5 35347
(5 features with cat 35347)