123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <!-- meta page description: Display drivers -->
- <!-- meta page index: display -->
- The current command line rendering mechanism is direct rendering into
- a file. The driver is selected by setting
- the <tt>GRASS_RENDER_IMMEDIATE</tt> variable or by
- running <em><a href="d.mon.html">d.mon</a></em> module.
- <p>
- <b>List of available display drivers:</b>
- <ul>
- <li><a href="cairodriver.html">Cairo driver</a>
- <li><a href="pngdriver.html">PNG driver</a>
- <li><a href="psdriver.html">PS driver (Postscript)</a>
- <li><a href="htmldriver.html">HTMLMAP driver</a>
- </ul>
- <h2>NOTES</h2>
- <h3>GRASS_RENDER_COMMAND</h3>
- If environmental variable GRASS_RENDER_COMMAND is defined,
- rendering is redirected by display library to the given external command
- defined by this variable. Currently only Python scrips are supported.
- <p>
- Lets start with simple example of Python script called <i>render.py</i>:
- <div class="code"><pre>
- #!/usr/bin/evn python
- import os
- import sys
- import grass.script as grass
- from grass.script import task as gtask
- os.environ['GRASS_RENDER_IMMEDIATE'] = 'default'
- os.environ['GRASS_RENDER_FILE'] = 'output.png'
- cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])
- grass.run_command('d.text', text="Test of GRASS_RENDER_COMMAND redirection")
- os.environ['GRASS_RENDER_FILE_READ'] = 'TRUE'
- grass.run_command(cmd, **dcmd)
- </pre></div>
- After defining GRASS_RENDER_COMMAND variable (example for Bash):
- <div class="code"><pre>
- export GRASS_RENDER_COMMAND=render.py
- </pre></div>
- Display GRASS modules like <em><a href="d.rast.html">d.rast</a></em>
- or <em><a href="d.vect.html">d.vect</a></em> will be executed
- by <i>render.py</i> program.
- For example the command
- <div class="code"><pre>
- d.vect roadsmajor
- </pre></div>
- produces output PNG file <i>output.png</i> which will contain rendered
- features from vector map <i>roadsmajor</i> and sample text <i>"Test of
- GRASS_RENDER_COMMAND redirection"</i>.
- <h2>SEE ALSO</h2>
- <em>
- <a href="d.mon.html">d.mon</a>,
- <a href="variables.html#list-of-selected-grass-environment-variables-for-rendering">variables</a>
- </em>
|