[GRASSLIST:161] RE: How to report length totals for all lines mat ching specific ID

Patton, Eric epatton at nrcan.gc.ca
Thu Mar 16 06:23:42 EST 2006


Hamish,

Thanks for bringing up that point. Fortunately, the coastline I'm reporting
lengths on is a 'final' product released by another gov't department, and so
is likely to be the authoritative source for quite some time (presumably).
Interesting links you sent.

I ended up doing pretty much what you described, using Michael's nice
v.extract interface in gis.m. Exporting vector SQL queries is easier than
doing the same in Arc now, as I was happy to demonstrate to an Arc-using
colleague.

~ Eric. 

-----Original Message-----
From: Hamish
To: Patton, Eric
Cc: GRASSLIST at baylor.edu
Sent: 3/15/2006 7:41 PM
Subject: Re: [GRASSLIST:138] How to report length totals for all lines
matching specific ID

> I have a vector of a coastline; the coast is segmented into different
> coastal types, according to unique IDs:
>
> CAT Class_ID CLASS         SEG_LENGTH
> 1   5        Rock Cliff    56.789000
> 2   7        Barrier Beach 13.450000
> ....
> 
> 
> I successfully popluated the SEG_LENGTH column with the length of each
> segment using v.to.db:
> 
> v.to.db Coastal_Classes option=length type=line units=m
> 
> Now I want to report total lengths of each CLASS (i.e., total length
> of all "Rock Cliff" segments, etc.)
> 
> Any ideas?


maybe not the most efficient way, but:

v.extract out=rock_cliff where="CLASS = 'Rock Cliff'"
v.out.ascii.db rock_cliff column=SEG_LENGTH  #from the wiki add-ons page

then add up in spreadsheet, matlab/octave, awk loop, etc.
Don't know of a UNIX command to do sums, but I'm sure there is one?
bc?


Note coastline length is a fractal problem and answers are only useful 
when compared against the same dataset, e.g. as a percentage of the
whole. Even then trusting it is a bit dubious (same digitizer at the
same level of fatigue, etc).

see-
http://mathworld.wolfram.com/CoastlineParadox.html
http://www.vanderbilt.edu/AnS/psychology/cogsci/chaos/workshop/Fractals.
html
http://en.wikipedia.org/wiki/How_Long_Is_the_Coast_of_Britain%3F_Statist
ical_Self-Similarity_and_Fractional_Dimension


Hamish




More information about the grass-user mailing list