Alternate Routes

The Alternate Routes function provides an easy way to request multiple potential routes between two locations. NOTE: This does not work for multi-point routes, only for routes between a single origin and a destination This function exposes two additional parameters (described below) beyond the regular Route function. A returned result will contain the main route, along with additional potential routes that could be used. NOTE: Additional routes will only be returned if the maxRoutes parameter is set to 2 or above - by default, the service does not return an alternate route.

Service Documentation

Service URL:

/directions/v1/alternateroutes

Parameters

Name Description
maxRoutes The maximum number of routes to return. Default = 1 (the original route, no alternates).

Note: The maximum value of maxRoutes is not strickly defined, but will be limited by the number of alternate routes MapQuest attempts to find.
timeOverage The percentage by which the expected drive time of an alternate is allowed to exceed the expected drive time of the original route. Default = 25.0. Alternate routes which exceed the allowed timeOverage will not be returned.

Note: Certain alternate routes (such as those which try to avoid toll roads if tolls were present in the original route) will increase the timeOverage value to allow more inclusive results.

Response

The response from an Alternate Routes call is identical to a normal Route call, with the following addtional response fields:

Response Field Description JSON Example Return Value(s) XML Example Return Value(s)
name A unique name for this route. The name will be determined by the MapQuest Platform Services server, but will most often been a road which is unique to this route.
name: MAIN ST.
<name>MAIN ST.</name>
alternateRoutes An array of Route Responses. Each Route Response will be a full Route Response. The routes will be listed in order from fastest to slowest.
{
...
alternateRoutes: [
   { ...
     name: "I-81 N",
     ... },
   { ... 
     name: "MAIN ST.",
     ... },
]
...
}
<response>
...
<alternateRoutes>
   <response>
      ...
      <name>I-81 N</name>
      ...
   </response>
   <response>
      ...
      <name>MAIN ST.</name>
      ...
   </response>
</alternateRoutes>
...
</response>

Live Sample

See this feature in action on our live Alternate Routes sample page (link will open in a new window.)

  © MapQuest, Inc. All rights reserved.    Privacy Policy | Terms of Use