Anyone,
Does anyone know how to measure the length of a line in a vector file?
Rhett Zufelt
Anyone,
Does anyone know how to measure the length of a line in a vector file?
Rhett Zufelt
ng240@ursus.pnl.gov (ng240@ursus.pnl.gov) writes on 10 Feb 94:
Does anyone know how to measure the length of a line in a vector file?
I've modified d.what.vect to do this (seems logical since it
already calculates areas). If these seems like something
that folks my want in 4.2, be sure that this diff gets to
the right person.
--Darrell
James Darrell McCauley, Purdue Univ, West Lafayette, IN 47907-1146, USA
mccauley@ecn.purdue.edu, mccauley%ecn@purccvm.bitnet, pur-ee!mccauley
** will finish PhD/engr in 9/94 - need job. inquiries welcome (no hh, plz) **
(Rhett: these are the mods that I told you about. only 10 lines).
% pwd
/tmp_mnt/net/soils7/aggrass/grass4.1/src.other/darrell/d.what.vect/cmd
% diff what.c what.c.orig
1d0
< #include <math.h>
25,26d23
< struct line_pnts *points;
< int i;
39d35
< points = Vect_new_line_struct();
94,99d89
<
< V2_read_line (Map, points, line);
< for(i=0,sq_meters=0.0; i<points->n_points-1; i++)
< sq_meters += hypot(points->x[i]-points->x[i+1],
< points->y[i]-points->y[i+1]);
< printf("Length - Meters: %.3lf\n",sq_meters);
---
I wrote on 11 Feb 94:
I've modified d.what.vect to do this (seems logical since it
already calculates areas). If these seems like something
some kind folks have pointed out that the length calculations are not
correct for lat-long. Thank you. I know. The area calculations in the
existing d.what.vect are probably not correct either for lat-long.
So... Don't use d.what.vect (or my mod) for anything where human lives
can be drastically altered or canceled. I've corrected the way that
lengths are calculated and sent these corrections to someone in
charge. Someday we'll get the areas right, too.
--Darrell