GRASS logo

NAME

Cairo driver - driver for bitmap or vector output using the Cairo graphics library.
(drivers)

DESCRIPTION

The Cairo driver generates PNG, BMP, PPM, PS, PDF or SVG images from GRASS display commands, using the Cairo graphics library. The image format is selected from the extension of the output file.

It is started as 'pseudo' monitor (output to an image file) and when stopped, all output from previously used display commands are written to the output file.

USAGE

Environment variables

Several environment variables affect the operation of the Cairo driver:

Examples

Example using the driver directly (bash-syntax):
export GRASS_CAIROFILE=spearfish.png
export GRASS_WIDTH=800
export GRASS_HEIGHT=800

d.mon start=cairo
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
d.vect map=roads width=2
d.mon stop=cairo
Example using d.out.file:
d.mon x0
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
d.vect map=roads width=2

d.out.file -c sf_cairo format=png size=800,800

A more complicated example using d.out.file:

r.shaded.relief map=elevation.dem
r.watershed elev=elevation.dem basin=watershed.basin thresh=10000

d.mon x1
d.shadedmap rel=elevation.dem.shade drape=watershed.basin bright=30
d.vect streams color=aqua fcolor=aqua type=area,line
d.vect roads where="label ~ 'light-duty road'" color=grey
d.vect roads where="label ~ 'unimproved'" color=orange
d.vect roads where="label ~ 'secondary highway'" color=100:100:100 width=2
d.vect roads where="label ~ 'primary highway'" color=50:50:50 width=2
d.vect railroads col=red width=2
d.vect roads where="label = 'interstate'" color=black width=3

d.vect archsites icon=basic/star size=25 fcolor=yellow

d.font Andale_Mono
echo "Spearfish, SD" | d.text color=black at=28,53 -b

d.out.file -c sf_cairo2 format=png

NOTES

The driver is still in development. Enable it by specifying --with-cairo when configuring GRASS. This requires a reasonably recent version of the Cairo libraries and a working pkg-config.

Antialiasing is enabled by default for bitmap formats. There is currently no way of disabling this.

Cairo supports true vector format output whenever possible. However, if the selected format doesn't support a necessary feature, Cairo may fall back on rendering a bitmap representation of the image wrapped in the selected vector format.

Cairo driver output via d.out.file is supported via the -c flag.

SEE ALSO

HTMLMAP driver, PNG driver, PostScript driver, XDRIVER
d.frame, d.mon, d.rast, d.vect d.out.file

AUTHOR

Lars Ahlzen <lars (at) ahlzen.com>
and the GRASS Development Team.