[GRASS-SVN] r36748 - grass/trunk/display/d.what.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 16 05:56:52 EDT 2009


Author: hamish
Date: 2009-04-16 05:56:52 -0400 (Thu, 16 Apr 2009)
New Revision: 36748

Modified:
   grass/trunk/display/d.what.vect/d.what.vect.html
   grass/trunk/display/d.what.vect/what.c
Log:
cleanup conversion to acres (merge from v.what; devbr6)

Modified: grass/trunk/display/d.what.vect/d.what.vect.html
===================================================================
--- grass/trunk/display/d.what.vect/d.what.vect.html	2009-04-16 09:55:21 UTC (rev 36747)
+++ grass/trunk/display/d.what.vect/d.what.vect.html	2009-04-16 09:56:52 UTC (rev 36748)
@@ -5,13 +5,15 @@
 in user-specified vector map layer(s). 
 
 <p>
-
 The program activates the mouse, and expects the user to indicate the 
 location(s) to be queried by depressing a mouse button over desired location(s) 
 within the current geographic region in the active display frame on the 
 graphic monitor. Query results from map(s) are by default displayed in a new 
 monitor, where label values can be added or changed. Using parameter <b>-x</b> 
 informations will be displayed as plain text to terminal window.
+<P>
+This module always reports standard acres, even when the location uses
+US Survey feet as the map unit.
 
 <h2>EXAMPLE</h2>
 
@@ -41,17 +43,23 @@
 middle mouse button toggles the flash color.
 The right button on the mouse is used to quit the <em>d.what.vect</em> session. 
 
+
 <h2>SEE ALSO</h2>
 
-<em><a HREF="d.rast.html">d.rast</a></em><br>
-<em><a HREF="d.vect.html">d.vect</a></em><br>
-<em><a HREF="d.what.rast.html">d.what.rast</a></em><br>
-<em><a HREF="g.region.html">g.region</a></em><br>
+<em><a HREF="d.rast.html">d.rast</a><br>
+<a HREF="d.vect.html">d.vect</a><br>
+<a HREF="d.what.rast.html">d.what.rast</a><br>
+<a HREF="g.region.html">g.region</a><br>
+<a HREF="v.what.html">v.what</a>
+</em>
 
+
 <h2>AUTHOR</h2>
 
 Jim Hinthorne,
 Central Washington University<br>
-Upgrades by Dennis Finch, National Park Service and Radim Blazek, ITC-Irst, Trento, Italy
+Upgrades by Dennis Finch, National Park Service
+ and Radim Blazek, ITC-Irst, Trento, Italy
 
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>

Modified: grass/trunk/display/d.what.vect/what.c
===================================================================
--- grass/trunk/display/d.what.vect/what.c	2009-04-16 09:55:21 UTC (rev 36747)
+++ grass/trunk/display/d.what.vect/what.c	2009-04-16 09:56:52 UTC (rev 36748)
@@ -26,7 +26,7 @@
     double east, north;
     int button;
     char east_buf[40], north_buf[40];
-    double sq_meters;
+    double sq_meters, sqm_to_sqft, acres, hectares, sq_miles;
     double x1, y1, x2, y2, z = 0, l = 0;
     int notty;
     double maxdist;
@@ -62,6 +62,12 @@
     else
 	notty = 0;
 
+    /* always use plain feet not US survey ft */
+    /*  if you really want USfeet, try G_database_units_to_meters_factor()
+	here, but then watch that sq_miles is not affected too */
+    sqm_to_sqft = 1 / ( 0.0254 * 0.0254 * 12 * 12 );
+
+
     do {
 	if (!terse)
 	    show_buttons(once);
@@ -321,6 +327,13 @@
 		}
 
 		sq_meters = Vect_get_area_area(&Map[i], area);
+		hectares  = sq_meters / 10000.;
+		/* 1 acre = 1 chain(66') * 1 furlong(10 chains),
+		    or if you prefer ( 5280 ft/mi ^2 / 640 acre/sq mi ) */
+		acres = (sq_meters * sqm_to_sqft) / (66 * 660);
+		sq_miles = acres / 640.;
+
+
 		if (topo) {
 		    int nisles, isleidx, isle, isle_area;
 
@@ -347,21 +360,19 @@
 		else if (txt) {
 		    fprintf(stdout,
 			    _("Size - Sq Meters: %.3f\t\tHectares: %.3f\n"),
-			    sq_meters, (sq_meters / 10000.));
+			    sq_meters, hectares);
 
 		    fprintf(stdout,
 			    _("           Acres: %.3f\t\tSq Miles: %.4f\n"),
-			    ((sq_meters * 10.763649) / 43560.),
-			    ((sq_meters * 10.763649) / 43560.) / 640.);
+			    acres, sq_miles);
 		    if (notty) {
 			fprintf(stderr,
 				_("Size - Sq Meters: %.3f\t\tHectares: %.3f\n"),
-				sq_meters, (sq_meters / 10000.));
+				sq_meters, hectares);
 
 			fprintf(stderr,
 				_("           Acres: %.3f\t\tSq Miles: %.4f\n"),
-				((sq_meters * 10.763649) / 43560.),
-				((sq_meters * 10.763649) / 43560.) / 640.);
+				acres, sq_miles);
 		    }
 		    nlines += 3;
 		}



More information about the grass-commit mailing list