[postgis-users] [Fwd: Re: [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 09:44:37 PST 2009

```My response on the pgrouting list.

-------- Original Message --------
Subject: Re: [pgrouting-users] How determining a path from two points
(X, Y) no node of the graph
Date: Fri, 06 Mar 2009 12:42:44 -0500
From: Stephen Woodbridge <woodbri at swoodbridge.com>
To: Pablo Velazco Villares <pvela at uci.cu>
CC: pgrouting-users at lists.postlbs.org
References: <1A668661A3AAA343B3C49E2F266DDAE004D9E4A5 at ucixw2.uci.cu>

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
_______________________________________________
Pgrouting-users mailing list
Pgrouting-users at lists.postlbs.org
http://lists.postlbs.org/mailman/listinfo/pgrouting-users

```