[GRASS-SVN] r67327 - grass/branches/releasebranch_7_0/vector/v.to.db

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 22 07:05:48 PST 2015


Author: annakrat
Date: 2015-12-22 07:05:48 -0800 (Tue, 22 Dec 2015)
New Revision: 67327

Modified:
   grass/branches/releasebranch_7_0/vector/v.to.db/areas.c
   grass/branches/releasebranch_7_0/vector/v.to.db/lines.c
   grass/branches/releasebranch_7_0/vector/v.to.db/v.to.db.html
Log:
v.to.db: apply patch from #2658 to fix units inconsistency (merge fom trunk, r67260)

Modified: grass/branches/releasebranch_7_0/vector/v.to.db/areas.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.to.db/areas.c	2015-12-22 14:50:09 UTC (rev 67326)
+++ grass/branches/releasebranch_7_0/vector/v.to.db/areas.c	2015-12-22 15:05:48 UTC (rev 67327)
@@ -40,6 +40,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/branches/releasebranch_7_0/vector/v.to.db/lines.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.to.db/lines.c	2015-12-22 14:50:09 UTC (rev 67326)
+++ grass/branches/releasebranch_7_0/vector/v.to.db/lines.c	2015-12-22 15:05:48 UTC (rev 67327)
@@ -123,6 +123,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/branches/releasebranch_7_0/vector/v.to.db/v.to.db.html
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.to.db/v.to.db.html	2015-12-22 14:50:09 UTC (rev 67326)
+++ grass/branches/releasebranch_7_0/vector/v.to.db/v.to.db.html	2015-12-22 15:05:48 UTC (rev 67327)
@@ -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