[GRASS-SVN] r67260 - grass/trunk/vector/v.to.db

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 19 17:31:08 PST 2015


Author: annakrat
Date: 2015-12-19 17:31:08 -0800 (Sat, 19 Dec 2015)
New Revision: 67260

Modified:
   grass/trunk/vector/v.to.db/areas.c
   grass/trunk/vector/v.to.db/lines.c
   grass/trunk/vector/v.to.db/v.to.db.html
Log:
v.to.db: apply patch from #2658 to fix units inconsistency

Modified: grass/trunk/vector/v.to.db/areas.c
===================================================================
--- grass/trunk/vector/v.to.db/areas.c	2015-12-20 01:03:01 UTC (rev 67259)
+++ grass/trunk/vector/v.to.db/areas.c	2015-12-20 01:31:08 UTC (rev 67260)
@@ -38,6 +38,8 @@
 	if ((options.option == O_COMPACT) || (options.option == O_FD) ||
 	    (options.option == O_PERIMETER)) {
 	    perimeter = Vect_get_area_perimeter(Map, area_num);
+	    if (G_projection() != PROJECTION_LL)
+		    perimeter = perimeter * G_database_units_to_meters_factor();
 	}
 
 	found = 0;

Modified: grass/trunk/vector/v.to.db/lines.c
===================================================================
--- grass/trunk/vector/v.to.db/lines.c	2015-12-20 01:03:01 UTC (rev 67259)
+++ grass/trunk/vector/v.to.db/lines.c	2015-12-20 01:31:08 UTC (rev 67260)
@@ -124,6 +124,8 @@
 		else if (options.option == O_LENGTH && (type & GV_LINES)) {
 		    /* Calculate line length */
 		    len = Vect_line_geodesic_length(Points);
+		    if (G_projection () != PROJECTION_LL)
+			    len = len * G_database_units_to_meters_factor();
 		    Values[idx].d1 += len;
 		}
 		else if (options.option == O_COOR && (type & GV_POINTS)) {

Modified: grass/trunk/vector/v.to.db/v.to.db.html
===================================================================
--- grass/trunk/vector/v.to.db/v.to.db.html	2015-12-20 01:03:01 UTC (rev 67259)
+++ grass/trunk/vector/v.to.db/v.to.db.html	2015-12-20 01:31:08 UTC (rev 67260)
@@ -8,6 +8,8 @@
 for closed lines (start equals end).
 
 <h2>NOTES</h2>
+Measures of lengths and areas are always reported in meters, unless the
+<em>unit</em> parameter is set.
 The units <em>miles</em>, <em>feet</em>, <em>meters</em> and
 <em>kilometers</em> are square for <em>option=area</em>.
 <p>Feet and acre units are always reported in their common versions



More information about the grass-commit mailing list