[GRASS-SVN] r62423 - in grass/branches/releasebranch_7_0/scripts: . d.to.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 27 12:15:57 PDT 2014


Author: annakrat
Date: 2014-10-27 12:15:57 -0700 (Mon, 27 Oct 2014)
New Revision: 62423

Added:
   grass/branches/releasebranch_7_0/scripts/d.to.rast/
   grass/branches/releasebranch_7_0/scripts/d.to.rast/Makefile
   grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.html
   grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.py
   grass/branches/releasebranch_7_0/scripts/d.to.rast/d_to_rast_3D_example.jpg
Log:
d.to.rast: fix missing parts in r62394

Added: grass/branches/releasebranch_7_0/scripts/d.to.rast/Makefile
===================================================================
--- grass/branches/releasebranch_7_0/scripts/d.to.rast/Makefile	                        (rev 0)
+++ grass/branches/releasebranch_7_0/scripts/d.to.rast/Makefile	2014-10-27 19:15:57 UTC (rev 62423)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = d.to.rast
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass/branches/releasebranch_7_0/scripts/d.to.rast/Makefile
___________________________________________________________________
Added: svn:mime-type
   + text/x-makefile
Added: svn:eol-style
   + native

Added: grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.html
===================================================================
--- grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.html	                        (rev 0)
+++ grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.html	2014-10-27 19:15:57 UTC (rev 62423)
@@ -0,0 +1,51 @@
+<h2>DESCRIPTION</h2>
+
+<em>d.to.rast</em> saves the content of the currently selected
+monitor into a raster map. The active monitor can be selected
+with <em>d.mon</em>. <em>d.to.rast</em> can be run from GUI
+command console, too. This module is not sensitive to computational region settings.
+
+<h2>EXAMPLE</h2>
+We combine different raster and vector map layers to create a composite layer
+which can be draped over elevation in 3D view.
+First, we add a couple of maps to layer manager:
+
+<div class="code"><pre>
+g.region rast=elevation
+d.rast map=elevation
+d.rast map=lakes
+d.vect map=roadsmajor width=4
+d.vect map=roadsmajor width=2 color=yellow
+
+# create a raster map from the display
+d.to.rast output=composite
+</pre></div>
+
+<p>
+Then uncheck all layers except for elevation and switch to 3D view.
+In Data tab, set color map to the newly created composite map.
+
+<p>
+<center>
+<img src="d_to_rast_3D_example.jpg">
+<p>
+Figure: Raster map created by <em>d.to.rast</em> draped over digital elevation model.
+</center>
+
+
+
+<h2>SEE ALSO</h2>
+ 
+<em>
+  <a href="d.out.file.html">d.out.file</a>,
+  <a href="d.erase.html">d.erase</a>,
+  <a href="d.rast.html">d.rast</a>,
+  <a href="d.vect.html">d.vect</a>,
+  <a href="d.mon.html">d.mon</a>
+</em>
+
+<h2>AUTHOR</h2>
+
+Anna Petrasova, <a href="http://gis.ncsu.edu/osgeorel/">NCSU OSGeoREL</a>
+
+<p><i>Last changed: $Date$</i>


Property changes on: grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.html
___________________________________________________________________
Added: svn:mime-type
   + text/html
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Added: grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.py	                        (rev 0)
+++ grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.py	2014-10-27 19:15:57 UTC (rev 62423)
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE: d.to.rast
+# AUTHOR(S): Anna Petrasova <kratochanna gmail.com>
+# PURPOSE:	Script for exporting content of monitor to raster map
+# COPYRIGHT: (C) 2014 by the GRASS Development Team
+#
+#		This program is free software under the GNU General
+#		Public License (>=v2). Read the file COPYING that
+#		comes with GRASS for details.
+#
+#############################################################################
+
+#%module
+#% description: Saves the contents of the active display monitor to a raster map.
+#% keywords: display
+#% keywords: export
+#% keywords: raster
+#%end
+#%option G_OPT_R_OUTPUT
+#%end
+
+
+from grass.script import core as gcore
+
+
+def main():
+    options, flags = gcore.parser()
+    print options, flags
+    gisenv = gcore.gisenv()
+    if 'MONITOR' in gisenv:
+        cmd_file = gisenv['MONITOR_{monitor}_CMDFILE'.format(monitor=gisenv['MONITOR'].upper())]
+        d_cmd = 'd.to.rast'
+        for param, val in options.iteritems():
+            if val:
+                d_cmd += " {param}={val}".format(param=param, val=val)
+        if gcore.overwrite():
+            d_cmd += ' --overwrite'
+        with open(cmd_file, "a") as file_:
+            file_.write(d_cmd)
+    else:
+        gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
+
+
+if __name__ == "__main__":
+    main()


Property changes on: grass/branches/releasebranch_7_0/scripts/d.to.rast/d.to.rast.py
___________________________________________________________________
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native

Added: grass/branches/releasebranch_7_0/scripts/d.to.rast/d_to_rast_3D_example.jpg
===================================================================
(Binary files differ)


Property changes on: grass/branches/releasebranch_7_0/scripts/d.to.rast/d_to_rast_3D_example.jpg
___________________________________________________________________
Added: svn:mime-type
   + image/jpeg



More information about the grass-commit mailing list