[GRASS-CVS] hamish: grass6/vector/v.to.db units.c,1.4,1.5

grass at intevation.de grass at intevation.de
Fri Nov 16 06:04:08 EST 2007


Author: hamish

Update of /grassrepository/grass6/vector/v.to.db
In directory doto:/tmp/cvs-serv538

Modified Files:
	units.c 
Log Message:
more precise conversions for square miles, feet, and acres


Index: units.c
===================================================================
RCS file: /grassrepository/grass6/vector/v.to.db/units.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- units.c	23 Apr 2007 11:01:14 -0000	1.4
+++ units.c	16 Nov 2007 11:04:06 -0000	1.5
@@ -7,7 +7,7 @@
     int     i;
     double  f=1.0, sq_f=1.0;
 
-    switch ( options.units)
+    switch (options.units)
     {
 	case U_METERS:
 	    f      = 1.0;
@@ -20,7 +20,7 @@
 	    break;
 
 	case U_ACRES:
-	    sq_f   = 2.471e-4;
+	    sq_f   = 2.47105381467165e-4; /* 640 acres in a sq mile */
 	    break;
 
 	case U_HECTARES:
@@ -28,13 +28,13 @@
 	    break;
 
 	case U_MILES:
-	    f      = 6.213e-4;
-	    sq_f   = 3.861e-7;
+	    f      = 6.21371192237334e-4; /*  1 / (0.0254 * 12 * 5280)    */
+	    sq_f   = 3.86102158542446e-7; /*  1 / (0.0254 * 12 * 5280)^2  */
 	    break;
 
 	case U_FEET:
-	    f      = 3.2808;
-	    sq_f   = 10.7639;
+	    f      = 3.28083989501312; /*  1 / (0.0254 * 12)    */
+	    sq_f   = 10.7639104167097; /*  1 / (0.0254 * 12)^2  */
 	    break;
     }
 




More information about the grass-commit mailing list