TrafficModel
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ฟิลด์นี้ระบุสมมติฐานข้อใดข้อหนึ่งต่อไปนี้ที่จะใช้เมื่อคำนวณเวลาในการเดินทางในสภาพการจราจร ซึ่งแสดงใน Enum ด้านล่าง duration
ฟิลด์ของการตอบกลับ TrafficModel จะแตกต่างกันไปตามการเลือก Enum ค่านี้ประกอบด้วยเวลาที่คาดการณ์ว่าจะถึงจุดหมายในการจราจร โดยอิงตามค่าเฉลี่ยที่ผ่านมา TrafficModel
ใช้ได้กับคำขอที่ตั้งค่า RoutingPreference
เป็น TRAFFIC_AWARE_OPTIMAL
และ RouteTravelMode
เป็น DRIVE
เท่านั้น
Enum |
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. |"]]