Determining lengths of vector lines
James Darrell McCauley
mccauley at ecn.purdue.edu
Fri Feb 11 16:12:01 EST 1994
ng240 at ursus.pnl.gov (ng240 at 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 at ecn.purdue.edu, mccauley%ecn at 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);
---
More information about the grass-user
mailing list