Cairo driver: Difference between revisions
Jump to navigation
Jump to search
(→Examples: update fancy example) |
m (OutDated) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{OutDated}} | |||
== Cairo display driver == | |||
(under development in GRASS 6.3-SVN) | |||
* [http://grass.osgeo.org/grass63/manuals/html63_user/cairodriver.html Cairo driver help page] | |||
The Cairo driver generates PNG, BMP, PPM, PS, PDF or SVG images from GRASS display commands, using the [http://cairographics.org/ Cairo graphics library]. The image format is selected from the extension of the output file. | The Cairo driver generates PNG, BMP, PPM, PS, PDF or SVG images from GRASS display commands, using the [http://cairographics.org/ Cairo graphics library]. The image format is selected from the extension of the output file. | ||
much of this page is based on this grass-dev thread: | much of this page is based on this grass-dev thread: | ||
Line 15: | Line 15: | ||
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) | 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 | Then configure grass with: | ||
--with-cairo | |||
If all went well, '<tt>d.mon -l</tt>' should list the drivers as available monitors. | |||
* For SVG, PS, and PDF output Debian/Etch users (with libcairo2 1.2.4-4) may need to update to libcairo2 1.4.14 from Sid. | |||
=== Examples === | === Examples === | ||
Example using the driver directly: | Example using the driver directly: | ||
Line 35: | Line 35: | ||
d.vect map=roads width=2 | d.vect map=roads width=2 | ||
d.mon stop=cairo | d.mon stop=cairo | ||
Example using ''d.out.file'': | Example using ''d.out.file'': | ||
Line 47: | Line 46: | ||
A more complicated example using ''d.out.file'': | A more complicated example using ''d.out.file'': | ||
[[Image:Cairo-example.jpg|500px|center]] | |||
r.shaded.relief map=elevation.dem | r.shaded.relief map=elevation.dem | ||
Line 75: | Line 76: | ||
d.out.file -c sf_cairo2 format=png | d.out.file -c sf_cairo2 format=png | ||
[[Category:Development]] | |||
[[Category:Documentation]] |
Latest revision as of 15:37, 5 February 2013
Cairo display driver
(under development in GRASS 6.3-SVN)
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.
much of this page is 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 configure grass with:
--with-cairo
If all went well, 'd.mon -l' should list the drivers as available monitors.
- For SVG, PS, and PDF output Debian/Etch users (with libcairo2 1.2.4-4) may need to update to libcairo2 1.4.14 from Sid.
Examples
Example using the driver directly:
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 export GRASS_WIDTH=800 export GRASS_HEIGHT=600 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=brown 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=200:80:80 width=2 d.vect roads where="label = 'interstate'" color=black width=3 d.vect roads where="label = 'interstate'" color=grey d.vect archsites icon=basic/star size=25 fcolor=yellow # save graphing instructions to file so it survives beyond current monitor (stdin can't be recreated) echo -e "width 2\nsymbol extra/fancy_compass 150 90 18 black" > dgr_tmp.txt d.graph dgr_tmp.txt d.text text="N" -b at=90,30.5 align=lc color=black d.font Andale_Mono d.text text="Spearfish, SD" -b color=black at=50,99 align=uc d.out.file -c sf_cairo2 format=png