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 Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\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. |"]]