[GRASS-user] vector segment lengths

Ken Mankoff mankoff at gmail.com
Wed Nov 28 23:55:57 PST 2018


Hi GRASS list,

How do I find out the length of each segment after running v.split?

I have this code:

v.split -f input=v output=v_split units=meters length=100 --o

I'd like to know the length. Presumably they are 100 m, but the last segment of each line in 'v' must be less than or equal to that.

I tried this:

v.db.addcolumn map=v_split column="length double precision"
v.to.db map=v_split type=line option=length columns=length units=meters

When I display with 'd.vect' and click, I see both 'v' and 'v_split'. When I click on a segment I see the total length of 'v' and the 100 m (or 42.214 for the end segment) of 'v_split'. But I don't see it when I query it at the command line with:

db.select sql='select * from v_split'

In this case, it only reports the original few segments from 'v', not the many 100s of segments from 'v_split'. It appears both vectors are linked to the same table.

Still (sometimes) trying to figure out the GRASS DB and layers connected to tables...

Thanks,

  -k.


More information about the grass-user mailing list