Browse Source

v.to.db: apply patch from https://trac.osgeo.org/grass/ticket/2658 to fix units inconsistency (merge fom trunk, https://trac.osgeo.org/grass/changeset/67260)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@67327 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 9 years ago
parent
commit
8a59a9e84e
3 changed files with 6 additions and 0 deletions
  1. 2 0
      vector/v.to.db/areas.c
  2. 2 0
      vector/v.to.db/lines.c
  3. 2 0
      vector/v.to.db/v.to.db.html

+ 2 - 0
vector/v.to.db/areas.c

@@ -40,6 +40,8 @@ int read_areas(struct Map_info *Map)
 	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;

+ 2 - 0
vector/v.to.db/lines.c

@@ -123,6 +123,8 @@ int read_lines(struct Map_info *Map)
 		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)) {

+ 2 - 0
vector/v.to.db/v.to.db.html

@@ -8,6 +8,8 @@ found or multiple categories were found. For line azimuths '-1' is used
 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