Please see the image below. (If you can't see the image please search "Bangalore to Palakkad" in Google Maps.) I am searching for a route from Bangalore to Palakkad. Google shows two routes. I think the first one is the shortest path and other is fastest. But look at the distance and time. 385 for the shortest (time to travel : 6hr 51 min) and 410 for fastest (time to travel : 6hr 7 min). How are they calculating this?

enter image description here

  • dont forget that the fastest path not always the shortest.
    – urcm
    Commented Aug 13, 2012 at 7:58

1 Answer 1


I think Google calculate a fastest route and then one or more alternatives, which may be shorter and slower, but not necessarily the shortest possible route.

Even the fastest may still have preference to using major roads compared to minor roads, even if the minor roads may be faster in some areas.

I think the alternatives are calculated by recalculating the route, but having a slightly higher cost on roads that has already been used in the first route. If that slightly higher cost still results in the same route, then no alternatives are suggested.

  • Thanks Uffe Kousgaard ... So I have to change cost value for that route in my database,right? Commented Aug 13, 2012 at 8:05
  • Yes, that is at least how I have planned to try something similar (with our own routing engine, www.routeware.dk, of course), but never has had time to do. I have no idea how the datastructure of postgis could do it. Commented Aug 13, 2012 at 8:24
  • Another way might be using different weights/costs. Instead of using pure time-costs or pure length-costs you can use an average of both.
    – Carsten
    Commented Aug 13, 2012 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.