[GRASS-SVN] r73607 - grass/trunk/raster/r.relief

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 24 12:57:18 PDT 2018


Author: martinl
Date: 2018-10-24 12:57:17 -0700 (Wed, 24 Oct 2018)
New Revision: 73607

Modified:
   grass/trunk/raster/r.relief/main.c
   grass/trunk/raster/r.relief/r.relief.html
Log:
r.relief: output is required (remove unused code + update manual)

Modified: grass/trunk/raster/r.relief/main.c
===================================================================
--- grass/trunk/raster/r.relief/main.c	2018-10-24 07:12:51 UTC (rev 73606)
+++ grass/trunk/raster/r.relief/main.c	2018-10-24 19:57:17 UTC (rev 73607)
@@ -78,7 +78,6 @@
     char buf[GNAME_MAX];
     int nrows, row;
     int ncols, col;
-    int overwrite=0;
 
     double zmult, scale, altitude, azimuth;
     double north, east, south, west, ns_med;
@@ -112,9 +111,10 @@
     module->label = _("Creates shaded relief map from an elevation map (DEM).");
     
     parm.elevation = G_define_standard_option(G_OPT_R_INPUT);
-
+    parm.elevation->description = _("Name of input raster (typically elevation) map");
+    
     parm.relief = G_define_standard_option(G_OPT_R_OUTPUT);
-    parm.relief->label = _("Name for output shaded relief map");
+    parm.relief->description = _("Name for output shaded relief map");
 
     parm.altitude = G_define_option();
     parm.altitude->key = "altitude";
@@ -168,34 +168,13 @@
     degrees_to_radians = M_PI / 180.0;
     radians_to_degrees = 180. / M_PI;
 
-    /* Check due to default output map = input.shade map */
-    overwrite = G_check_overwrite(argc, argv);
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     elev_name = parm.elevation->answer;
-    if (parm.relief->answer) {
-	sr_name = parm.relief->answer;
-    }
-    else {
-	char xname[GNAME_MAX], xmapset[GNAME_MAX];
-	
-	if (G_name_is_fully_qualified(elev_name, xname, xmapset))
-	    sprintf(buf, "%s.shade", xname);
-	else
-	    sprintf(buf, "%s.shade", elev_name);
-	sr_name = G_store(buf);
-    }
+    sr_name = parm.relief->answer;
 
     G_check_input_output_name(elev_name, sr_name, G_FATAL_EXIT);
-    if (G_find_raster2(sr_name, G_mapset())) {
-        if (overwrite)
-            G_warning(_("Raster map <%s> already exists and will be overwritten"),
-			 sr_name);
-	    else
-            G_fatal_error(_("Raster map <%s> already exists"), sr_name);
-    }
 
     if (sscanf(parm.altitude->answer, "%lf", &altitude) != 1 || altitude < 0.0) {
 	G_fatal_error(_("%s=%s - must be a non-negative number"),

Modified: grass/trunk/raster/r.relief/r.relief.html
===================================================================
--- grass/trunk/raster/r.relief/r.relief.html	2018-10-24 07:12:51 UTC (rev 73606)
+++ grass/trunk/raster/r.relief/r.relief.html	2018-10-24 19:57:17 UTC (rev 73607)
@@ -1,22 +1,20 @@
 <h2>DESCRIPTION</h2>
 
-<em>r.relief</em> creates a raster shaded relief map based on 
-current resolution settings and on sun altitude, azimuth, and 
-z-exaggeration values entered by the user. If no output shademap 
-name is given, the new shaded relief map is named <em><input_map
->.shade</em>. The map is assigned a grey-scale color table.
+<em>r.relief</em> creates a raster shaded relief map based on current
+resolution settings and on sun altitude, azimuth, and z-exaggeration
+values entered by the user.
 
 <p>The parameters controlling the shading are:
 <ol>
-<li>A raster map layer to provide elevation values for the shaded 
-relief map.  Typically, this would be a map layer of elevation; 
+<li>An <b>input</b> raster map to provide elevation values for the shaded 
+relief map. Typically, this would be a map layer of elevation; 
 however, any raster map layer can be named.
 
 <li>The <b>altitude</b> of the sun in degrees above the horizon
 (a value between 0 and 90 degrees).
 
-<li>The <b>azimuth</b> of the sun in degrees to the east of north
-(a value between 0 and 360 degrees; clockwise from north).
+<li>The <b>azimuth</b> of the sun in degrees to the east of north (a
+value between 0 and 360 degrees; clockwise from north)
 
 <li>The scaling parameter, which compensates for a different 
 horizontal <b>scale</b> than vertical scale. If <b>scale</b> is a 
@@ -25,7 +23,7 @@
 vertical scales.)
 
 <li>The <b>zscale</b> exaggeration factor that changes the apparent relief
-for the shaded relief map.  This can be any positive (or negative) floating
+for the shaded relief map. This can be any positive (or negative) floating
 point value. (Default=1.0)
 
 <li>Horizontal distances are calculated in meters, using geodesic 
@@ -42,10 +40,11 @@
 
 <h2>NOTES</h2>
 
-To visually improve the result of shade maps from low resolution elevation
-models, use <em>r.resamp.interp</em> with bilinear or bicubic method to
-resample the DEM at higher resolution. <em>r.relief</em> is then
-run on the resampled DEM.
+To visually improve the result of shade maps from low resolution
+elevation models,
+use <em><a href="r.resamp.interp.html">r.resamp.interp</a></em> with
+bilinear or bicubic method to resample the DEM at higher
+resolution. <em>r.relief</em> is then run on the resampled DEM.
 
 <h2>EXAMPLES</h2>
 
@@ -67,7 +66,10 @@
 
 <h3>Colorizing a shaded relief map</h3>
 
-Color can be added later using <em><a href="r.shade.html">r.shade</a></em>:
+Color can be added later
+using <em><a href="r.shade.html">r.shade</a></em>
+or <em><a href="d.shade.html">d.shade</a></em>:
+
 <div class="code"><pre>
 r.shade shade=elevation_shade color=elevation output=elevation_shaded
 </pre></div>
@@ -89,9 +91,10 @@
 map to GeoTIFF format along with its associated color table due to limitations
 in the GeoTIFF format.
 <p>
-The most simple way to export it while even reducing the file size is to
-export as palette byte map. This requires a conversion done in <tt>r.mapcalc</tt>,
-using the # operator to convert map category values to their grey scale
+The most simple way to export it while even reducing the file size is
+to export as palette byte map. This requires a conversion done
+in <em><a href="r.mapcalc.html">r.mapcalc</a></em>, using the #
+operator to convert map category values to their grey scale
 equivalents:
 
 <div class="code"><pre>
@@ -98,7 +101,7 @@
 # using the map created above
 
 # create new map from map category values
-r.mapcalc "elevation_shade_byte = #elevation_shade"
+r.mapcalc expression="elevation_shade_byte = #elevation_shade"
 
 # verify data range
 r.info elevation_shade_byte
@@ -118,13 +121,6 @@
 <h2>SEE ALSO</h2>
 
 <p>
-<!--
-  RGB version not ported to GRASS 6 (why?):
-  <em><a href="shade.clr.sh.html">shade.clr.sh</a></em><br>
-  d.shade and r.shade probably cover most of the shade.clr functionality
-  however, it is not possible to create shade+color map in one step
-  delete this note when it is solved or if it is not considered as an issue
--->
 <em>
 <a href="d.shade.html">d.shade</a>,
 <a href="d.his.html">d.his</a>,



More information about the grass-commit mailing list