If you ask three people for directions to somewhere they journey to frequently, you are likely to receive three different sets of directions. Each person will have some short-cut, or uses one road over another because of traffic, or has a particular highway they always want to avoid. Personally, I'll drive extra miles down unnecessary roads just to avoid traffic lights. I know its an illusion, but even if the trip ultimately takes longer than sitting at traffic lights along a shorter road, I'd rather keep moving.
In order to emulate the experience of having multiple friends bicker about which is the best route you should take, our Directions team have created ....(wait for it)... Alternate Routes! (Dun Dun DUUUN!) Joking aside, I think this is very very cool functionality. The function call is basically the same as a regular route call, with a couple of extra parameters:, and looks like this:
maxRoutes parameter is how many total possible routes you want back, including the first (or "main") one. The
Overage is a percentage extra time thats allowable for an alternate route to take. For example, on an hour-long route, an overage of 25 is 25% would be up to an extra 15 minutes.
So lets say you set a
maxRoutes=3. The response will include the "main" route, just like normal, plus an additional node containing up to two other routes that provide alternative ways to your destination. Each route will also have a new "name" node to help identify them. We try to fill this with the name of a road that is unique to that particular route. Each route is complete with narrative, road shields and thumbnail maneuver maps.
Here is an example of travelling from Harrisburg to Reading in pennsylvania, asking for a total of three routes (2 alternate routes):
The Main Route, which we named "Interstate 76 E", takes you down to the Pennsylvania Turnpike. It is calculated to take 1 hour 7 minutes to travel just under 59 miles.
The first Alternate Route avoids the Turnpike, and instead takes you up Interstate 81 and along Interstate 78. It takes a few more minutes overall, but avoids a big toll road. It is calculated to take 1 hour 12 minutes to travel around 63 miles.
The second Alternate Route takes you in a very direct route along Routes 322 and 222. It is shorter than the other routes, but takes a little longer than both of them, clicking in at 1 hour 21 minutes, to travel under 55 miles.
So thats how it works!. Pretty darn cool, eh? More details, Documentation and sample links are found (as always) on the Developer Network beta page. The sample I took the screenshots from is part of the service documentation
Let us know on the Beta Forums if you find any issues, or if you create a cool application using Alternate Routes.