Cairo driver: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(→‎Examples: ex2 rev2)
Line 40: Line 40:
A more complicated example using ''d.out.file'':
A more complicated example using ''d.out.file'':


  d.erase
r.shaded.relief map=elevation.dem
  d.vect -c fields type=area
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 streams color=aqua fcolor=aqua type=area,line
  d.vect roads where="label ~ 'light-duty road'" color=grey
  d.vect roads where="label ~ 'light-duty road'" color=grey
  d.vect roads where="label ~ 'unimproved'" color=orange
  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 ~ 'secondary highway'" color=100:100:100 width=2
  d.vect roads where="label ~ 'primary highway'" color=50:50:50 width=2
  d.vect roads where="label ~ 'primary highway'" color=50:50:50 width=2
  d.vect railroads col=red width=2
  d.vect railroads col=red width=2
  d.vect roads where="label = 'interstate'" color=black width=3
  d.vect roads where="label = 'interstate'" color=black width=3
d.vect archsites icon=extra/fancy_compass size=40
   
   
  d.out.file -c sf_c1 form=png --o
d.vect archsites icon=basic/star size=25 fcolor=yellow
d.font Andale_Mono
echo "Spearfish, SD" | d.text color=black at=28.6,53.5 -b
  d.out.file -c sf_cairo2 format=png

Revision as of 09:50, 22 November 2007

Cairo display driver

(under development)

based on this grass-dev thread:

http://thread.gmane.org/gmane.comp.gis.grass.devel/22786

To compile GRASS 6.3 with Cairo support, make sure you have the cairo.h include file (in Debian/Etch it's in the libcairo2-dev package)

Then build grass with:

make USE_CAIRO=1

Examples

Example using the driver directly:

export GRASS_TRUECOLOR=TRUE
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.6,53.5 -b


d.out.file -c sf_cairo2 format=png