[pgrouting-users] Shortest Path TRSP

Max Weninger max.weninger at gmail.com
Tue Feb 28 11:21:12 EST 2012


Hi

Thanks for the explanation - now it make sense :)
And the new "version" works great

Before I solved all those "special" cases in
"user space" by selecting source or target nodes and
also adding edges if required

Now since this is solved in the trsp my code becomes
much easier and clearer.

Regards

max

On Tue, 28 Feb 2012 09:15:23 -0500
Stephen Woodbridge <woodbri at swoodbridge.com> wrote:

> The percentage is along the line in the direction it is defined in
> the database. The start point is 0.0 and the end point of the line is
> 1.0. So if you use ST_Line_Locate_Point() [1] the return is
> appropriate for percent along edge.
> 
> -Steve
> 
> [1] 
> http://www.postgis.org/documentation/manual-1.5/ST_Line_Locate_Point.html
> 
> On 2/28/2012 9:03 AM, Max Weninger wrote:
> > Hi
> >
> > Is there any documantation available how to use the
> > startPos and endPos parameters - for the new "edge based" trsp API?
> >
> > ...
> >>    0.5.   -- percent along start edge
> >>    0.5    -- percent along end edge
> > ...
> >
> > How to interpret those values?
> >
> > Thanks
> >
> > max
> >
> > On Mon, 27 Feb 2012 17:03:11 -0500
> > Stephen Woodbridge<woodbri at swoodbridge.com>  wrote:
> >
> >> On 2/27/2012 4:42 PM, "Christophe Damour (SIGéal)" wrote:
> >>> Hi,
> >>>
> >>> I am trying to use trsp shortest path function, but get a "Source
> >>> Not Found" error.
> >>> Here is my query :
> >>> SELECT edge_id FROM turn_restrict_shortest_path(
> >>> 'SELECT id_tron as id, source::integer, target::integer,
> >>> cost::double precision as cost, rev_cost::double precision as
> >>> reverse_cost FROM reseau_global',
> >>> 15326,
> >>> 8756,
> >>> true,
> >>> true,
> >>> 'SELECT to_cost::double precision, target_id::integer,
> >>> via_path::text FROM reseau_global_rest'
> >>> ), reseau_global
> >>> WHERE edge_id = id_tron;
> >>>
> >>> reseau_global is my network table, and reseau_global_rest is my
> >>> turn restriction table.
> >>> In the latter, target_id column contains destination edges ids and
> >>> via_path a list of forbidden origin edges.
> >>>
> >>> What am I doing wrong ?
> >>>
> >>> Thank for any hints,
> >>>
> >>
> >> Typically this means that you are probably entering edge_ids for
> >> source and target and not node_ids.
> >>
> >> Also, there is another version of the API that does take edge_ids
> >> for the start and end of the route rather than node_ids. You would
> >> call it like this:
> >>
> >> SELECT edge_id FROM turn_restrict_shortest_path(
> >>    'SELECT id_tron as id, source::integer, target::integer,
> >>    cost::double precision as cost, rev_cost::double precision as
> >>    reverse_cost FROM reseau_global',
> >>    15326, -- start edge_id
> >>    0.5.   -- percent along start edge
> >>    8756,  -- end edge_id
> >>    0.5    -- percent along end edge
> >>    true,
> >>    true,
> >>    'SELECT to_cost::double precision, target_id::integer,
> >> via_path::text FROM reseau_global_rest'
> >>    ), reseau_global
> >>    WHERE edge_id = id_tron;
> >>
> >> Using the edge + percent is better because it allow you to take
> >> into account restrictions and onewayness of the start and end
> >> edges that can not be done with the version you are using. This
> >> was a recent update to git so you might want to pull an updated
> >> versions.
> >>
> >> -Steve W
> >> _______________________________________________
> >> Pgrouting-users mailing list
> >> Pgrouting-users at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
> >
> > _______________________________________________
> > Pgrouting-users mailing list
> > Pgrouting-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/pgrouting-users
> 
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users



More information about the Pgrouting-users mailing list