[GRASS-SVN] r64403 - in grass/trunk: display lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 2 09:28:42 PST 2015


Author: martinl
Date: 2015-02-02 09:28:42 -0800 (Mon, 02 Feb 2015)
New Revision: 64403

Modified:
   grass/trunk/display/displaydrivers.html
   grass/trunk/lib/init/variables.html
Log:
document GRASS_RENDER_COMMAND


Modified: grass/trunk/display/displaydrivers.html
===================================================================
--- grass/trunk/display/displaydrivers.html	2015-02-02 16:21:54 UTC (rev 64402)
+++ grass/trunk/display/displaydrivers.html	2015-02-02 17:28:42 UTC (rev 64403)
@@ -15,6 +15,57 @@
   <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>

Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html	2015-02-02 16:21:54 UTC (rev 64402)
+++ grass/trunk/lib/init/variables.html	2015-02-02 17:28:42 UTC (rev 64403)
@@ -378,15 +378,21 @@
   <dt>GRASS_RENDER_TEXT_SIZE</dt>
   <dd>defines default text size.</dd>
 
+  <dt>GRASS_RENDER_COMMAND</dt>
+  <dd>external command called by display library to render data (see
+    example in <em><a href="displaydrivers.html">display
+    drivers</a></em> page for details).<br>Currently only Python scripts
+    are supported.</dd>
+
 </dl>
 
 For specific driver-related variables see:
 
 <ul>
-  <li><em><a href="cairodriver.html">Cairo driver</a></em></li>
-  <li><em><a href="pngdriver.html">PNG driver</a></em></li>
-  <li><em><a href="psdriver.html">PS (Postscript) driver</a></em></li>
-  <li><em><a href="htmldriver.html">HTML driver</a></em></li>
+  <li><em><a href="cairodriver.html">Cairo display driver</a></em></li>
+  <li><em><a href="pngdriver.html">PNG display driver</a></em></li>
+  <li><em><a href="psdriver.html">PS (Postscript) display driver</a></em></li>
+  <li><em><a href="htmldriver.html">HTML display driver</a></em></li>
 </ul>
 
 <h3>List of selected internal GRASS environment variables</h3>



More information about the grass-commit mailing list