Routes Preferred API is currently available only to select customers.
Contact sales to learn more.
Configure the Quality vs Latency Trade-off
Stay organized with collections
Save and categorize content based on your preferences.
The Routes Preferred API provides three routing preferences for
calculating routes. They differ in the extent that they factor traffic
conditions into the route calculation. Each routing preference produces results
that differ to a degree in regard to route quality, estimated ETA, and response
latency.
About traffic conditions
Traffic conditions characterize the rate of traffic flow. For example:
When there is no congestion, traffic conditions are considered normal, and
traffic flows at the regular unimpeded speed.
Approaching rush-hour, traffic density increases, which causes traffic to slow
down, producing light to moderate traffic conditions.
In bumper-to-bumper traffic, the flow-rate grinds to a halt, producing heavy
traffic conditions.
Traffic unaware
When you set the
TRAFFIC_UNAWARE
routing preference, routes are calculated without accounting for traffic
conditions. This routing preference provides the lowest response latency
(responses are returned the quickest).
Use this routing preference when you want responses returned the quickest, and
approximate routing details are good enough.
Traffic aware
When you set the
TRAFFIC_AWARE
routing preference, routes are calculated accounting for traffic conditions. As
a result, the route and route details more accurately reflect real-world
conditions. Since this increase in data quality comes at the expense of response
latency, performance optimizations are applied to reduce much of the latency.
Use this routing preference when you want more accurate routing details, and yet
you don't mind if responses are returned with a moderate increase in latency.
Traffic aware optimal
When you set the
TRAFFIC_AWARE_OPTIMAL
routing preference, routes are calculated accounting for traffic conditions, but
no performance optimizations are applied. In this mode, the server performs a
more exhaustive search of the road network to find the optimal route.
This routing preference provides the highest response latency (i.e., responses
return with the longest delay). Use this routing preference when you want
results of the highest quality, without regard to how long responses take.
Example
The following JSON code demonstrates how to set the routing preference in a
request message entity body.
{
"origin":{
"location":{
"latLng":{
"latitude":37.419734,
"longitude":-122.0827784
}
}
},
"destination":{
"location":{
"latLng":{
"latitude":37.417670,
"longitude":-122.079595
}
}
},
"travelMode":"DRIVE",
"routingPreference":"TRAFFIC_AWARE_OPTIMAL"
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe Routes Preferred API offers three routing preferences: \u003ccode\u003eTRAFFIC_UNAWARE\u003c/code\u003e, \u003ccode\u003eTRAFFIC_AWARE\u003c/code\u003e, and \u003ccode\u003eTRAFFIC_AWARE_OPTIMAL\u003c/code\u003e, each considering traffic conditions differently.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTRAFFIC_UNAWARE\u003c/code\u003e provides the fastest response but with approximate routes, ideal when speed is prioritized over accuracy.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTRAFFIC_AWARE\u003c/code\u003e balances accuracy and speed, producing realistic routes with moderate latency.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTRAFFIC_AWARE_OPTIMAL\u003c/code\u003e delivers the most accurate routes by conducting a comprehensive search, but results in the longest response time.\u003c/p\u003e\n"],["\u003cp\u003eThese preferences allow developers to prioritize speed or accuracy based on their specific application needs.\u003c/p\u003e\n"]]],["The Routes Preferred API offers three routing preferences: `TRAFFIC_UNAWARE`, `TRAFFIC_AWARE`, and `TRAFFIC_AWARE_OPTIMAL`. `TRAFFIC_UNAWARE` ignores traffic, providing the fastest response. `TRAFFIC_AWARE` considers traffic, balancing accuracy with moderate latency. `TRAFFIC_AWARE_OPTIMAL` exhaustively searches for the best route accounting for traffic, resulting in the highest quality but with the longest latency. The API allows setting these preferences in requests, for example using JSON. Traffic conditions are classified as normal, light to moderate, or heavy.\n"],null,["# Configure the Quality vs Latency Trade-off\n\nThe Routes Preferred API provides three routing preferences for\ncalculating routes. They differ in the extent that they factor traffic\nconditions into the route calculation. Each routing preference produces results\nthat differ to a degree in regard to route quality, estimated ETA, and response\nlatency.\n\nAbout traffic conditions\n------------------------\n\nTraffic conditions characterize the rate of traffic flow. For example:\n\n- When there is no congestion, traffic conditions are considered normal, and\n traffic flows at the regular unimpeded speed.\n\n- Approaching rush-hour, traffic density increases, which causes traffic to slow\n down, producing light to moderate traffic conditions.\n\n- In bumper-to-bumper traffic, the flow-rate grinds to a halt, producing heavy\n traffic conditions.\n\nTraffic unaware\n---------------\n\nWhen you set the\n[`TRAFFIC_UNAWARE`](/maps/documentation/routes_preferred/reference/rest/v1alpha/TopLevel/computeRoutes#RoutingPreference.ENUM_VALUES.TRAFFIC_UNAWARE)\nrouting preference, routes are calculated without accounting for traffic\nconditions. This routing preference provides the lowest response latency\n(responses are returned the quickest).\n\nUse this routing preference when you want responses returned the quickest, and\napproximate routing details are good enough.\n\nTraffic aware\n-------------\n\nWhen you set the\n[`TRAFFIC_AWARE`](/maps/documentation/routes_preferred/reference/rest/v1alpha/TopLevel/computeRoutes#RoutingPreference.ENUM_VALUES.TRAFFIC_UNAWARE)\nrouting preference, routes are calculated accounting for traffic conditions. As\na result, the route and route details more accurately reflect real-world\nconditions. Since this increase in data quality comes at the expense of response\nlatency, performance optimizations are applied to reduce much of the latency.\n\nUse this routing preference when you want more accurate routing details, and yet\nyou don't mind if responses are returned with a moderate increase in latency.\n\nTraffic aware optimal\n---------------------\n\nWhen you set the\n[`TRAFFIC_AWARE_OPTIMAL`](/maps/documentation/routes_preferred/reference/rest/v1alpha/TopLevel/computeRoutes#RoutingPreference.ENUM_VALUES.TRAFFIC_UNAWARE)\nrouting preference, routes are calculated accounting for traffic conditions, but\nno performance optimizations are applied. In this mode, the server performs a\nmore exhaustive search of the road network to find the optimal route.\n\nThis routing preference provides the highest response latency (i.e., responses\nreturn with the longest delay). Use this routing preference when you want\nresults of the highest quality, without regard to how long responses take.\n\nExample\n-------\n\nThe following JSON code demonstrates how to set the routing preference in a\nrequest message entity body. \n\n```cplint\n{\n \"origin\":{\n \"location\":{\n \"latLng\":{\n \"latitude\":37.419734,\n \"longitude\":-122.0827784\n }\n }\n },\n \"destination\":{\n \"location\":{\n \"latLng\":{\n \"latitude\":37.417670,\n \"longitude\":-122.079595\n }\n }\n },\n \"travelMode\":\"DRIVE\",\n \"routingPreference\":\"TRAFFIC_AWARE_OPTIMAL\"\n}\n```"]]