[pgrouting-users] Shortest Path TRSP

Max Weninger max.weninger at gmail.com
Tue Feb 28 09:03:47 EST 2012


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



More information about the Pgrouting-users mailing list