On 04/18/2011 01:55 PM, Micha Silver wrote:


Maybe a few more details might be helpful:
If you want to first get the coordinates of the new points along the (simplified) river line, (starting with a line vector 'river' and a set of points 'old_pts' displaced from the line) you first do:

~>v.db.addtable old_pts col="x double precision, y double precision"

then:

~>v.distance --o to=river from=old_pts out=connectors upload=to_x,to_y col=x,y

This puts the *new* X-Y coordinates of points exactly on the river, and at the node of perpendicular 'connectors' from the old points to the river into the old_pts attribute table.
Now:

~>v.db.select -c old_pts col=x,y >new_pts.txt
~>v.db.select -c old_pts fs=, col=x,y | v.in.ascii  out=new_pts

THis gives you both a new point vector of the points along the river, and a text file of their coordinates. Next, I used Moritz's method to split the river at these new points, in a loop like:

~>while read coord; do v.edit river tool=break coord=$coord; done < new_pts.txt

This leaves you with a multi-segment line vector, split at the new points.


v.net option=connect + some cleaning afterwards might be another possible solution. For each point, it will create a line connecting it to the river, breaking the river at the intersection.

v.distance should be able to do the labelling for you.


I tried this part, but couldn't get it to work :-( .
....

So I don't know what to suggest to get the cat values from the new points into the river segments...



Update:
I have found a kind of work around to get the same cat values in both the points and river segments, although it's a bit "backwards". THe modules v.distance and v.what.vect can only connect from a point vector to another line or area vector. Then values from the "to" (line or area) can be uploaded to the points. So if I reset the categories in the river line vector - so that each segment has it;s own cat, then I can upload those cat values into the new points vector. Here's the procedure:

FIrst blow away the existing categories in the river vector and recreate a new vector with new category values:

~>v.category river opt=del out=river2 --o
~ > v.db.droptable -f river2
~ > v.db.addtable river2
~ > v.category river2 out=river3 --o

Now river3 should contain a new cat value, one for each line segment. Check with:

~ > v.category river3 opt=print
1
2
3
.....

And finally:
~ > v.db.addcol new_pts col="river_cat integer"
~ > v.what.vect vect=new_pts col=river_cat qvect=river3 qcol=cat dmax=0.01

creates a new column in the new_pts vector attrib table called 'river_cats' with values matching the adjacent river segment.

Regards,
Micha

Regards,
Micha


_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to