TrafficModel
Specifies the assumptions to use when calculating time in traffic. This setting affects the value returned in the duration
field in the response, which contains the predicted time in traffic based on historical averages.
Enums |
TRAFFIC_MODEL_UNSPECIFIED |
Unused. If specified, will default to BEST_GUESS . |
BEST_GUESS |
Indicates that the returned duration should be the best estimate of travel time given what is known about both historical traffic conditions and live traffic. Live traffic becomes more important the closer the departureTime is to now. |
PESSIMISTIC |
Indicates that the returned duration should be longer than the actual travel time on most days, though occasional days with particularly bad traffic conditions may exceed this value. |
OPTIMISTIC |
Indicates that the returned duration should be shorter than the actual travel time on most days, though occasional days with particularly good traffic conditions may be faster than this value. |
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 2024-06-20 UTC.
[null,null,["Last updated 2024-06-20 UTC."],[[["The `duration` field provides estimated travel time influenced by the `traffic_model` setting."],["`traffic_model` options include `BEST_GUESS` (default), `PESSIMISTIC`, and `OPTIMISTIC`, impacting travel time predictions."],["`BEST_GUESS` considers historical and live traffic data for travel time estimation, with live traffic having more impact closer to departure."],["`PESSIMISTIC` and `OPTIMISTIC` offer durations longer and shorter than actual travel times on most days, respectively, accounting for traffic variations."]]],["The core content outlines how to specify traffic-based time calculations, impacting the `duration` field. The `TRAFFIC_MODEL_UNSPECIFIED` defaults to `BEST_GUESS`, which uses historical and live data to estimate travel time. `PESSIMISTIC` calculates a longer travel time, likely exceeded only in severe conditions. Conversely, `OPTIMISTIC` calculates a shorter time, potentially beaten during favorable conditions. These options modify the estimated duration by factoring in historical traffic data and real-time conditions.\n"]]