Description | : The `Route Directions` API is an HTTP `POST` request that returns the ideal route between an origin and destination for automobile (driving), commercial trucks and walking routes. The route passes through a series of waypoints if specified. A waypoint is a geographical location defined by longitude and latitude that is used for navigational purposes. The route considers factors such as current traffic and the typical road speeds on the requested day of the week and time of day. The API returns the distance, estimated travel time, and a representation of the route geometry. More routing information such as an optimized waypoint order or turn by turn instructions is also available, depending on the parameters used. The Route Directions considers local laws, vehicle dimensions, cargo type, max speed, bridge and tunnel heights to calculate the truck specific routes and avoid complex maneuvers and difficult roads. Not all trucks can travel the same routes as other vehicles due to certain restrictions based on the vehicle profile or cargo type. For example, highways often have separate speed limits for trucks, some roads don't allow trucks with flammable or hazardous materials, and there can be height and weight restriction on bridges. Up to 25 waypoints and 10 viaWaypoints between any two waypoints is supported for driving and walking routes. Each set of waypoints creates a separate route Leg. ViaWaypoints define the route path and can be used for route creation through specific locations, but they don't create route Legs. Truck routes support up to 150 waypoints but don't support viaWaypoints. For information about routing availability in countries/regions, see [Azure Maps routing coverage](https://learn.microsoft.com/azure/azure-maps/routing-coverage?pivots=route-v2). >[!Important] >By using this feature, you agree to the preview legal terms. For more information, see [Preview Supplemental Terms](https://azure.microsoft.com/en-us/support/legal/preview-supplemental-terms/). |
Reference | : Link ¶ |
⚶ Changes
{ "#id": "Route_PostRouteDirections", "$parameters": { "routeDirectionsRequest": { "$properties": [ { "features": { "$properties": { "properties": [ { "#name": "pointType", "Enum": { "new": [ [ "waypoint", "A waypoint is a specific location or point along a route or trip that serves as a reference or stopping point." ], [ "viaWaypoint", "A viaWaypoint is a specific waypoint that must be passed through or visited along a route or trip." ] ], "old": [ [ "waypoint", "A waypoint is a specific location or point along a route or trip that serves as a reference or stopping point." ], [ "viaWaypoint", "A viaWaypoint is a specific waypoint that must be passed through or visited along a route or trip. `Note`: Only supported for driving travelMode." ] ] } } ] } } }, { "#name": "optimizeRoute", "Enum": { "new": [ [ "shortest", "The route is calculated to minimize the distance. Traffic information is not used." ], [ "fastestWithoutTraffic", "Finds the fastest route, without factoring in traffic information." ], [ "fastestAvoidClosureWithoutTraffic", "" ], [ "fastestWithTraffic", "The route is calculated to minimize the time using current traffic information. `Note`: Only supported for driving and truck travelMode." ] ], "old": [ [ "shortest", "The route is calculated to minimize the distance. Traffic information is not used." ], [ "fastestWithoutTraffic", "Finds the fastest route, without factoring in traffic information." ], [ "fastestAvoidClosureWithoutTraffic", "The route is calculated to minimize the time and avoid road closures. No traffic information except for road closures is used in the calculation. `Note`: Only supported for driving travelMode." ], [ "fastestWithTraffic", "The route is calculated to minimize the time using current traffic information. `Note`: Only supported for driving and truck travelMode." ] ] } }, { "#name": "optimizeWaypointOrder", "Description": { "new": "Re-order the route waypoints using a fast heuristic algorithm to reduce the route cost specified with the optimize parameter. The origin and destination are excluded from the optimized waypoint and their position is considered fixed. Acceptable values are true or false.", "old": "Re-order the route waypoints using a fast heuristic algorithm to reduce the route cost specified with the optimize parameter. The origin and destination are excluded from the optimized waypoint and their position is considered fixed. Acceptable values are true or false.\n\n`Note`: Only supported for truck travelMode." } }, { "avoid": { "Enum": { "new": [ [ "limitedAccessHighways", "Avoids the use of limited access highways in the route." ], [ "tollRoads", "Avoids the use of toll roads in the route." ], [ "ferries", "Avoids the use of ferries in the route." ], [ "tunnels", "Avoids the use of tunnels in the route." ], [ "borderCrossings", "Avoids crossing country borders in the route." ], [ "lowEmissionZones", "Avoids low-emission zones in the route." ], [ "unpavedRoads", "Avoids unpaved roads in the route." ] ], "old": [ [ "limitedAccessHighways", "Avoids the use of limited access highways in the route." ], [ "tollRoads", "Avoids the use of toll roads in the route." ], [ "ferries", "Avoids the use of ferries in the route." ], [ "tunnels", "Avoids the use of tunnels in the route. `Note`: Only supported for truck travelMode." ], [ "borderCrossings", "Avoids crossing country borders in the route." ], [ "lowEmissionZones", "Avoids low-emission zones in the route. `Note`: Only supported for truck travelMode." ], [ "unpavedRoads", "Avoids unpaved roads in the route. `Note`: Only supported for truck travelMode." ] ] } } }, { "#name": "routeOutputOptions", "Description": { "new": "Include the desired route information from the response. By default, the itinerary is included in the response.\n\nSupports multiple values such as \"routeOutputOptions\": [\"routePath\", \"itinerary\"]", "old": "Include the desired route information from the response. By default, the itinerary is included in the response.\n\nSupports multiple values such as \"routeOutputOptions\": [\"routePath\", \"regionTravelSummary\"]" }, "$items": { "Enum": { "new": [ [ "routeSummary", "Include only travel time and distance for the route, and do not provide other information." ], [ "routePath", "Include a GeoJSON MultiLineString [RFC 7946, section 3.1.5](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.5) that describe the route's path in the response." ], [ "itinerary", "Include detailed directions in the response. Detailed directions are provided as \"ManeuverPoints\" and contain details such as turn-by-turn instructions." ] ], "old": [ [ "routeSummary", "Include only travel time and distance for the route, and do not provide other information." ], [ "regionTravelSummary", "Include travel summary of distance, time, and toll road distance by two entity types: country (e.g., US, Canada) and administrative division or subregion (e.g., \"state\" in US and \"province\" in Canada). `Note`: Only supported for driving and walking travelMode" ], [ "routePath", "Include a GeoJSON MultiLineString [RFC 7946, section 3.1.5](https://www.rfc-editor.org/rfc/rfc7946#section-3.1.5) that describe the route's path in the response." ], [ "itinerary", "Include detailed directions in the response. Detailed directions are provided as \"ManeuverPoints\" and contain details such as turn-by-turn instructions." ] ] } } }, { "#name": "maxRouteCount", "Description": { "new": "The maximum number of routes to return. Available for the driving and truck travel modes.\n\nDefault: \"maxRouteCount\":1", "old": "The maximum number of routes to return. Available for the driving and truck travel modes.\n\nFor driving routes, this parameter supports routes with up to two waypoints in addition to the origin and destination and avoid parameter must not be set.\n\nDefault: \"maxRouteCount\":1\n\nMinimum: \"maxRouteCount\":1\n\nMaximum: \"maxRouteCount\":3" } }, { "#name": "heading", "Description": { "new": "The initial directional heading of the vehicle in degrees starting at true North and continuing in clockwise direction. North is 0 degrees, east is 90 degrees, south is 180 degrees, west is 270 degrees.", "old": "The initial directional heading of the vehicle in degrees starting at true North and continuing in clockwise direction. North is 0 degrees, east is 90 degrees, south is 180 degrees, west is 270 degrees. Possible values 0-359" } } ] } } }
⚼ Request
POST:
/route/directions
{
api-version:
string
,
x-ms-client-id:
string
,
Accept-Language:
string
,
routeDirectionsRequest:
}
{
,
type:
enum
,
features:
[
]
,
{
,
type:
enum
,
geometry:
object
,
properties:
}
{
,
pointIndex:
integer
,
pointType:
enum
,
}
travelMode:
enum
,
departAt:
string
,
arriveAt:
string
,
optimizeRoute:
enum
,
optimizeWaypointOrder:
boolean
,
avoid:
[
,
string
,
]
routeOutputOptions:
[
,
string
,
]
maxRouteCount:
integer
,
heading:
integer
,
vehicleSpec:
object
,
}
⚐ Response (200)
{
$schema:
object
,
}
⚐ Response (default)
{
$headers:
{
,
x-ms-error-code:
string
,
}
$schema:
}
{
,
error:
}
{
,
code:
string
,
message:
string
,
target:
string
,
details:
[
,
string
,
]
innererror:
}
{
,
code:
string
,
innererror:
string
,
}