I would like to know if it is possible to change the way the itinerary calculation algorithm works in the Google Maps API (or Bing Maps). Basically, I'd like to add options, like for example "shortest route" or "avoid highways and national roads".
I haven't found anything in the API that might manage the road's cost, so I think it's n开发者_JS百科ot possible but maybe someone's got an idea of a way to do that?
There is no way to modify the pathfinder algorithm beyond the avoidHighways
and avoidTolls
options. See here for documentation:
http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsRequest
Another method would be to specify provideRouteAlternatives
and figure out which of these routes is best according to your own heuristic.
精彩评论