[pgrouting-users] Fastest path instead of shortest path

Hey guys,

Instead of calculating routes based on shortest path I want to calculate routes based on fastest path. I already have a column with drivetime information (ie in table ‘ways’ there is a column called ‘time’ with minutes). Can this be done with the hereunder code and, if yes, what do I need to change? Thank you!

case ‘SPD’ : // Shortest Path Dijkstra

$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 dijkstra_sp_delta(

‘“.TABLE.”’,

“.$startEdge[‘source’].”,

“.$endEdge[‘target’].”,

) as rt

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

break;

Regards,

Frank

Hi Frank,

calculating "shortest path" is always the "fastest path". The cost column is
at the begin the length from the edge. All you need is to change the cost/
reverse_cost values.

Gr
Ralf

Am Mittwoch 04 August 2010, 15:07:50 schrieb Salet Frank:

Hey guys,

Instead of calculating routes based on shortest path I want to calculate
routes based on fastest path. I already have a column with drivetime
information (ie in table 'ways' there is a column called 'time' with
minutes). Can this be done with the hereunder code and, if yes, what do I
need to change? Thank you!

    case 'SPD' : // Shortest Path Dijkstra
      $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 dijkstra_sp_delta(
                            '".TABLE."',
                            ".$startEdge['source'].",
                            ".$endEdge['target'].",
                            3000)
                     ) as rt
                WHERE ".TABLE.".gid=rt.gid;";
      break;

Regards,
Frank