TrafficModel
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
此字段用于指定在计算交通状况下的出行时间时要使用的假设,如下面的枚举所示。根据所选的枚举,TrafficModel 响应的 duration
字段会有所不同。该值包含根据历史平均数据预测的交通时间(到达目的地所需的时间)。TrafficModel
仅适用于将 RoutingPreference
设置为 TRAFFIC_AWARE_OPTIMAL
且将 RouteTravelMode
设置为 DRIVE
的请求。
枚举 |
TRAFFIC_MODEL_UNSPECIFIED |
未使用。如果指定,则默认为 BEST_GUESS 。 |
BEST_GUESS |
表示返回的 duration 应该是最准确的行程时间估算值(根据已知的历史路况信息和实时路况信息得出)。departureTime 越接近当前时间,实时路况信息就越重要。 |
PESSIMISTIC |
表示返回的时长在大多数日子里应该长于实际行程时间,但偶尔路况特别糟糕的时候,实际行程时间可能会超过该值。 |
OPTIMISTIC |
表示返回的时长在大多数日子里应该短于实际行程时间,但偶尔路况特别理想的时候,实际行程时间可能会小于该值。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThe \u003ccode\u003eduration\u003c/code\u003e field provides estimated travel time influenced by the \u003ccode\u003etraffic_model\u003c/code\u003e setting.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003etraffic_model\u003c/code\u003e options include \u003ccode\u003eBEST_GUESS\u003c/code\u003e (default), \u003ccode\u003ePESSIMISTIC\u003c/code\u003e, and \u003ccode\u003eOPTIMISTIC\u003c/code\u003e, impacting travel time predictions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBEST_GUESS\u003c/code\u003e considers historical and live traffic data for travel time estimation, with live traffic having more impact closer to departure.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePESSIMISTIC\u003c/code\u003e and \u003ccode\u003eOPTIMISTIC\u003c/code\u003e offer durations longer and shorter than actual travel times on most days, respectively, accounting for traffic variations.\u003c/p\u003e\n"]]],["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"],null,["# TrafficModel\n\nSpecifies 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.\n\n| Enums ||\n|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `TRAFFIC_MODEL_UNSPECIFIED` | Unused. If specified, will default to `BEST_GUESS`. |\n| `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. |\n| `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. |\n| `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. |"]]