[GRASS-SVN] r64177 - grass/trunk/raster/r.slope.aspect

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 14 07:32:16 PST 2015


Author: annakrat
Date: 2015-01-14 07:32:16 -0800 (Wed, 14 Jan 2015)
New Revision: 64177

Modified:
   grass/trunk/raster/r.slope.aspect/main.c
   grass/trunk/raster/r.slope.aspect/r.slope.aspect.html
Log:
r.slope.aspect: change behavior for locations where units are not meters #2536

Modified: grass/trunk/raster/r.slope.aspect/main.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/main.c	2015-01-14 15:28:00 UTC (rev 64176)
+++ grass/trunk/raster/r.slope.aspect/main.c	2015-01-14 15:32:16 UTC (rev 64177)
@@ -241,7 +241,7 @@
     parm.zfactor = G_define_option();
     parm.zfactor->key = "zscale";
     parm.zfactor->description =
-	_("Multiplicative factor to convert elevation units to meters");
+	_("Multiplicative factor to convert elevation units to horizontal units");
     parm.zfactor->type = TYPE_DOUBLE;
     parm.zfactor->required = NO;
     parm.zfactor->answer = "1.0";
@@ -382,10 +382,11 @@
     /* V = window.ns_res * 4 * 2/ zfactor; *//* vertical (north-south) run 
        times 4 for weighted difference */
 
-    /* give warning if location units are different from meters and zfactor=1 */
+    /* we don't assume vertical units to be meters any more */
     factor = G_database_units_to_meters_factor();
-    if (factor != 1.0)
-	G_warning(_("Converting units to meters, factor=%.6f"), factor);
+    if (factor != 1.0 && zfactor != 1.0)
+    	G_warning(_("r.slope.aspect does not convert horizontal units "
+                    "to meters in this version, see manual page."));
 
     G_begin_distance_calculations();
     north = Rast_row_to_northing(0.5, &window);
@@ -393,8 +394,8 @@
     south = Rast_row_to_northing(2.5, &window);
     east = Rast_col_to_easting(2.5, &window);
     west = Rast_col_to_easting(0.5, &window);
-    V = G_distance(east, north, east, south) * 4 / zfactor;
-    H = G_distance(east, ns_med, west, ns_med) * 4 / zfactor;
+    V = G_distance(east, north, east, south) * 4 / (factor * zfactor);
+    H = G_distance(east, ns_med, west, ns_med) * 4 / (factor * zfactor);
     /*    ____________________________
        |c1      |c2      |c3      |
        |        |        |        |
@@ -551,8 +552,8 @@
 	    south = Rast_row_to_northing((row + 0.5), &window);
 	    east = Rast_col_to_easting(2.5, &window);
 	    west = Rast_col_to_easting(0.5, &window);
-	    V = G_distance(east, north, east, south) * 4 / zfactor;
-	    H = G_distance(east, ns_med, west, ns_med) * 4 / zfactor;
+	    V = G_distance(east, north, east, south) * 4 / (factor * zfactor);
+	    H = G_distance(east, ns_med, west, ns_med) * 4 / (factor * zfactor);
 	    /*        ____________________________
 	       |c1      |c2      |c3      |
 	       |        |        |        |

Modified: grass/trunk/raster/r.slope.aspect/r.slope.aspect.html
===================================================================
--- grass/trunk/raster/r.slope.aspect/r.slope.aspect.html	2015-01-14 15:28:00 UTC (rev 64176)
+++ grass/trunk/raster/r.slope.aspect/r.slope.aspect.html	2015-01-14 15:32:16 UTC (rev 64177)
@@ -5,15 +5,17 @@
 elevation values. The user must specify the input <b>elevation</b> raster map
 and at least one output raster maps. The user can also specify the
 <b>format</b> for slope (degrees, percent; default=degrees), and the 
-<b>zscale</b>: multiplicative factor to convert elevation units to meters;
+<b>zscale</b>: multiplicative factor to convert elevation units to horizontal units;
 (default 1.0).
 
 <p>
 The <b>elevation</b> input raster map specified by the user must contain true
 elevation values, <em>not</em> rescaled or categorized data. If the elevation
-values are in feet or other units than meters (with a conversion factor
-<i>meters:</i>, defined in PROJ_UNITS), they must be converted to meters using
-the parameter <b>zscale</b>.
+values are in other units than in the horizontal units,
+they must be converted to horizontal units using the parameter <b>zscale</b>.
+<em>In GRASS GIS 7, vertical units are not assumed to be meters any more.
+For example, if both your vertical and horizontal units are feet,
+parameter <b>zscale</b> must not be used</em>.
 
 <p>
 The <b>aspect</b> output raster map indicates the direction that slopes are



More information about the grass-commit mailing list