[pgrouting-users] How determining a path from two points (X, Y) no node of the graph

Stephen Woodbridge woodbri at swoodbridge.com
Fri Mar 6 12:42:44 EST 2009


Pablo Velazco Villares wrote:
> Hello colleagues,
> 
> I am starting my work with pgRouting, not work well with road
> networks.
> 
> I need to know if possible or is there some function that supports
> the analysis of route from fucking X, Y located on or near a given
> edge.
> 
> ie not necesariametente, take into account two nodes or vertices
> (start or end of an edge)
> 
> resuntante require that the path includes only a portion of the edge
> source or target of the solution ... thank you all and hope to have
> been sufficiently explicit ... because I am trying to communicate a
> complex issue in a strange language
> 
> if someone can give me a hand with this, it will be very grateful

Paul,

You have to split the starting edge and ending edge and use the part you 
need. postGIS has tools to do this. I don't have my postGIS manual in 
front of me, but here are the basic steps:

pct := ST_line_locate_point(segment, point);

a2pct := ST_line_substring(segment, 0.0, pct);
pct2b := ST_line_substring(segment, pct, 1.0);


a2pct is the segment from the start of the line to the point and pct2b 
is the segment from the point to the end of the line. You have to decide 
which substring you need to use based on how things are connected in the 
results.

-Steve



More information about the Pgrouting-users mailing list