[GRASSLIST:681] Re: Shortest distance routing

Radim Blazek blazek at itc.it
Thu Jul 10 04:17:51 EDT 2003


On Wednesday 09 July 2003 12:04, you wrote:
> Radim Blazek wrote:
> > Look at v.net.path.
>
> Is it in CVS now?

Yes.

> > Which informations about segments do you need,
> > categories of lines on shortest path?
>
> I was also wanting start and end coordinates of each segment.

Currently v.net.path does not print list of segments, but to add this
should not be more than 2 rows with fprintf(). To print the list
to standard output is easy, I don't know, how to write it to the database.
One varchar column in the table could become very long and it is not very
usable. What do you think about second table 
<vect_name>_segments (sp_id int, order_id int, line_id int, direction int)? 

Your custom module written for this task may be better,
I'll describe here, how to use standard GRASS modules to get such results
for others.

All v.net.* modules identify nodes by category number of a point on the node.
v.net operation=node creates such points on line network and
v.category assigns new categories to the points.
v.net operation=report prints 'line_cat start_point_cat end_point_cat'
v.to.db option=coor uploads x,y of pints to database.
And combine in the database the result. 

> Another thing I need to look at is actually travelling a certain
> distance on a known vector/segment, which I am looking at now.

I am not sure if I understand well, but to create a point on the line
on a given distance or to cut a segment from the line from start to end
distance along the line, you can use v.segment.
To do this in your module, use Vect_point_on_line() and
Vect_line_segment() functions.


Radim




More information about the grass-user mailing list