[GRASS-SVN] r57732 - grass/branches/develbranch_6/scripts/d.shadedmap
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 18 00:33:34 PDT 2013
Author: hamish
Date: 2013-09-18 00:33:34 -0700 (Wed, 18 Sep 2013)
New Revision: 57732
Modified:
grass/branches/develbranch_6/scripts/d.shadedmap/d.shadedmap
grass/branches/develbranch_6/scripts/d.shadedmap/description.html
Log:
add option to save result to a new raster map
Modified: grass/branches/develbranch_6/scripts/d.shadedmap/d.shadedmap
===================================================================
--- grass/branches/develbranch_6/scripts/d.shadedmap/d.shadedmap 2013-09-17 13:53:35 UTC (rev 57731)
+++ grass/branches/develbranch_6/scripts/d.shadedmap/d.shadedmap 2013-09-18 07:33:34 UTC (rev 57732)
@@ -5,7 +5,7 @@
# MODULE: d.shadedmap
# AUTHOR(S): Unknown; updated to GRASS 5.7 by Michael Barton
# PURPOSE: Uses d.his to drape a color raster over a shaded relief map
-# COPYRIGHT: (C) 2004 by the GRASS Development Team
+# COPYRIGHT: (C) 2004-2013 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
@@ -15,7 +15,7 @@
#%Module
-#% description: Drapes a color raster over a shaded relief map using d.his
+#% description: Drapes a color raster over a shaded relief map using d.his.
#%End
#%option
#% key: reliefmap
@@ -38,16 +38,39 @@
#% options: -99-99
#% answer: 0
#%end
+#%option
+#% key: output
+#% type: string
+#% gisprompt: new,cell,raster
+#% key_desc: name
+#% description: Create raster map from result (optional)
+#% required: no
+#%end
if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
+ echo "You must be in GRASS GIS to run this program." 1>&2
+ exit 1
fi
if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
+ exec g.parser "$0" "$@"
fi
-exec d.his "h_map=$GIS_OPT_DRAPEMAP" "i_map=$GIS_OPT_RELIEFMAP" \
- "brighten=$GIS_OPT_BRIGHTEN"
+if [ -n "$GIS_OPT_OUTPUT" ] ; then
+ TMPBASE="tmp_drape.$$"
+ TMP_R="$TMPBASE.r"
+ TMP_G="$TMPBASE.g"
+ TMP_B="$TMPBASE.b"
+
+ r.his h_map="$GIS_OPT_DRAPEMAP" i_map="$GIS_OPT_RELIEFMAP" \
+ r_map="$TMP_R" g_map="$TMP_G" b_map="$TMP_B"
+
+ r.composite red="$TMP_R" green="$TMP_G" blue="$TMP_B" \
+ output="$GIS_OPT_OUTPUT"
+
+ g.remove rast="$TMP_R,$TMP_G,$TMP_B" --quiet
+fi
+
+exec d.his h_map="$GIS_OPT_DRAPEMAP" i_map="$GIS_OPT_RELIEFMAP" \
+ brighten="$GIS_OPT_BRIGHTEN"
Modified: grass/branches/develbranch_6/scripts/d.shadedmap/description.html
===================================================================
--- grass/branches/develbranch_6/scripts/d.shadedmap/description.html 2013-09-17 13:53:35 UTC (rev 57731)
+++ grass/branches/develbranch_6/scripts/d.shadedmap/description.html 2013-09-18 07:33:34 UTC (rev 57732)
@@ -2,31 +2,55 @@
<em>d.shadedmap</em> will drape a color raster map over a shaded relief map.
+
<h2>NOTES</h2>
-refer to the <em>d.his</em> help page for more details; <em>d.shadedmap</em>
+Refer to the <em>d.his</em> help page for more details; <em>d.shadedmap</em>
is simply a frontend to that module.
+<p>
+If the <b>output</b> option is given the rendering will be written to a
+new raster map. The <b>output</b> map does not respect the <b>brighten</b>
+parameter. <!-- at this time. -->
-<h2>EXAMPLE</h2>
-In this example, the aspect map in the North Carolina sample
-dataset location is used to hillshade the elevation map:
+<h2>EXAMPLES</h2>
+In this example, the <tt>aspect</tt> map in the North Carolina sample
+dataset location is used to hillshade the <tt>elevation</tt> map:
+
<div class="code"><pre>
g.region rast=aspect -p
d.shadedmap reliefmap=aspect drapemap=elevation
</pre></div>
+In this next example, a shaded relief raster map is created in
+the Spearfish sample dataset and used to create a colorized hillshade
+raster map for later use:
+
+<div class="code"><pre>
+g.region rast=elevation.10m
+r.colors -e map=elevation.10m color=haxby
+r.shaded.relief elevation.10m
+
+d.shadedmap reliefmap=elevation.10m.shade drapemap=elevation.10m \
+ output=elevation.10m.shade.colorized
+
+r.colors -r map=elevation.10m
+</pre></div>
+
+
<h2>SEE ALSO</h2>
<em>
<a href="d.his.html">d.his</a>,
<a href="g.pnmcomp.html">g.pnmcomp</a>,
-<a href="nviz.html">NVIZ</a>,
+<a href="r.his.html">r.his</a>,
<a href="r.slope.aspect.html">r.slope.aspect</a>,
-<a href="r.shaded.relief.html">r.shaded.relief</a>
+<a href="r.shaded.relief.html">r.shaded.relief</a><br>
+<a href="nviz.html">NVIZ</a>
</em>
+
<h2>AUTHORS</h2>
Unknown; updated to GRASS 5.7 by Michael Barton
More information about the grass-commit
mailing list