[GRASS-dev] Cairo monitor driver

Lars Ahlzen lars at ahlzen.com
Mon Oct 15 21:59:02 EDT 2007

Carlos "Guâno" Grohmann wrote:
> Can you give some examples of the usage? (not the final product, but
> the commands)
> thanks

Sure... the usage is virtually identical to other drivers like the X or 
PNG drivers.

For example, you may start GRASS with everyone's favorite South Dakotan 
dataset, set up the environment and start a monitor. Then use the 
standard GRASS drawing commands to draw, and finally close the monitor, 
which will output the result to a file.

Here's a very simple example:

lars at saturn ~ $ grass63
Welcome to GRASS 6.3.cvs (2007)
GRASS homepage:                          http://grass.itc.it/
This version running thru:               Bash Shell (/bin/bash)
Help is available with the command:      g.manual -i
See the licence terms with:              g.version -c
Start the graphical user interface with: gis.m
When ready to quit enter:                exit
GRASS 6.3.cvs (spearfish60):~ > d.mon -l
name            description
----            -----------
PNG             Create PNG Map
png1            Create PNG Map
ps7             Create PS Map
CAIRO           Create Cairo Map
cairo1          Create Cairo Map
cairo2          Create Cairo Map
cairo3          Create Cairo Map
cairo4          Create Cairo Map
cairo5          Create Cairo Map
cairo6          Create Cairo Map
cairo7          Create Cairo Map
x0              X-windows graphics display
x1              X-windows graphics display
x7              X-windows graphics display
GRASS 6.3.cvs (spearfish60):~ > export GRASS_TRUECOLOR=TRUE
GRASS 6.3.cvs (spearfish60):~ > export GRASS_CAIROFILE=spearfish.png
GRASS 6.3.cvs (spearfish60):~ > export GRASS_WIDTH=1000
GRASS 6.3.cvs (spearfish60):~ > export GRASS_HEIGHT=1000
GRASS 6.3.cvs (spearfish60):~ > d.mon start=CAIRO
CAIRO: collecting to file: spearfish.png
Graphics driver [CAIRO] started
GRASS 6.3.cvs (spearfish60):~ > d.rast map=elevation.10m
GRASS 6.3.cvs (spearfish60):~ > d.vect map=streams width=1 color=blue
GRASS 6.3.cvs (spearfish60):~ > d.vect map=roads width=2
GRASS 6.3.cvs (spearfish60):~ > d.mon stop=CAIRO
Monitor 'CAIRO' terminated
GRASS 6.3.cvs (spearfish60):~ > ls *.png

/ Lars

Lars Ahlzen
lars at ahlzen.com

More information about the grass-dev mailing list