TrafficModel
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این فیلد یکی از مفروضات زیر را برای محاسبه زمان سفر در شرایط ترافیکی مشخص می کند که در شماره های زیر نشان داده شده است. بسته به enum انتخاب شده، فیلد duration
پاسخ TrafficModel متفاوت خواهد بود. این مقدار شامل زمان پیشبینیشده تا مقصد در ترافیک، بر اساس میانگینهای تاریخی است. TrafficModel
فقط برای درخواستهایی در دسترس است که RoutingPreference
روی TRAFFIC_AWARE_OPTIMAL
و RouteTravelMode
را روی DRIVE
تنظیم کردهاند.
Enums |
---|
TRAFFIC_MODEL_UNSPECIFIED | استفاده نشده اگر مشخص شود، بهطور پیشفرض روی BEST_GUESS خواهد بود. |
BEST_GUESS | نشان می دهد که duration بازگشت باید بهترین تخمین زمان سفر با توجه به آنچه در مورد شرایط ترافیک تاریخی و ترافیک زنده شناخته شده است باشد. هرچه زمان departureTime به زمان حال نزدیکتر باشد، ترافیک زنده اهمیت بیشتری پیدا میکند. |
PESSIMISTIC | نشان می دهد که مدت زمان بازگشت باید بیشتر از زمان واقعی سفر در بیشتر روزها باشد، اگرچه روزهای گاه به گاه با شرایط ترافیکی به خصوص بد ممکن است از این مقدار فراتر رود. |
OPTIMISTIC | نشان میدهد که مدت زمان بازگشت باید در بیشتر روزها کوتاهتر از زمان واقعی سفر باشد، اگرچه ممکن است روزهای گاه به گاه با شرایط ترافیکی خوب سریعتر از این مقدار باشد. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\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. |"]]