[GRASS-SVN] r36747 - grass/branches/releasebranch_6_4/display/d.what.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 16 05:55:21 EDT 2009


Author: hamish
Date: 2009-04-16 05:55:21 -0400 (Thu, 16 Apr 2009)
New Revision: 36747

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

Modified: grass/branches/releasebranch_6_4/display/d.what.vect/description.html
===================================================================
--- grass/branches/releasebranch_6_4/display/d.what.vect/description.html	2009-04-16 09:50:08 UTC (rev 36746)
+++ grass/branches/releasebranch_6_4/display/d.what.vect/description.html	2009-04-16 09:55:21 UTC (rev 36747)
@@ -5,14 +5,17 @@
 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>
 
 A sample <em>d.what.vect</em> session is given below. Although it is not 
@@ -41,17 +44,24 @@
 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/branches/releasebranch_6_4/display/d.what.vect/what.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.what.vect/what.c	2009-04-16 09:50:08 UTC (rev 36746)
+++ grass/branches/releasebranch_6_4/display/d.what.vect/what.c	2009-04-16 09:55:21 UTC (rev 36747)
@@ -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;
@@ -74,6 +74,12 @@
 	flash_basecolr = YELLOW;
     }
 
+    /* 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 (flash)
 	    R_panel_save(panell, R_screen_top(), R_screen_bot(),
@@ -352,6 +358,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;
 
@@ -378,21 +391,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