[pgrouting-users] Problem with shortest_path_shooting_star and reverse_cost

Adil BOUMAZOUED boumazoued at gmail.com
Mon Feb 7 09:11:08 EST 2011


Hi,

I have a problem with shortest_path_shooting_star and shootingstar_sp

I use pgRouting-1.03_pg-8.3.7 with postgresql-8.3.10-1-windows and
postgis-pg83-setup-1.3.3-1

For Data, i use a personal data.

I create my graph and I add "temps" as "cost" and "reverse_temps" as
"reverse_cost" and I set reverse_temps=1000000 when direction=1.


When I run shortest_path_shooting_star :

$sql = "SELECT roads.edge_id0, AsText(roads.the_geom) AS wkt, roads.length,
roads.gid

            FROM roads, (SELECT edge_id FROM
shortest_path_shooting_star('SELECT gid as id, source, target,temps as
cost,reverse_temps as reverse_cost, x1, y1, x2, y2, rule, to_cost FROM roads
order by id',

            ".$startEdge['gid'].",

            ".$endEdge['gid'].",

              true, true)) as rt

              WHERE ".TABLE.".gid=rt.edge_id;";

Pgrouting return a bad calcul (it not considerate reverse_cost : figure 1)

Value 0 : both trajet

Value 1 : one direction (drawing direction)


 When I use shootingstar_sp :

$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,

                     length(rt.the_geom) AS length, ".TABLE.".id

                  FROM ".TABLE.",

                      (SELECT gid, the_geom

                          FROM shootingstar_sp(

                              '".TABLE."',

                              ".$startEdge['gid'].",

                              ".$endEdge['gid'].",

                              1, 'temps',true,true)

                       ) as rt

                  WHERE ".TABLE.".gid=rt.gid;";

I have a similar result (figure 1).


But when I use :

$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,

                     length(rt.the_geom) AS length, ".TABLE.".id

                  FROM ".TABLE.",

                      (SELECT gid, the_geom

                          FROM shootingstar_sp(

                              '".TABLE."',

                              ".$startEdge['gid'].",

                              ".$endEdge['gid'].",

                              1, 'temps',true,false)

                       ) as rt

                  WHERE ".TABLE.".gid=rt.gid;";

I have a correct result (figure 2), but my graph will not be oriented and I
whill have bad calcul when I navigate between roads who have both direction
(figure 3 is correct but figure4 is not correct).


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20110207/4cf56667/attachment.html


More information about the Pgrouting-users mailing list