gpt4 book ai didi

ios - 使用 Google API 在 iOS 中估计两个位置(纬度和经度)之间的时间

转载 作者:行者123 更新时间:2023-11-29 00:58:04 25 4
gpt4 key购买 nike

我有来自两个位置的 google api 链接

http://maps.googleapis.com/maps/api/directions/json?&mode=driving&origin=12.9862449,80.2094988&destination=12.9229153,80.1274558&sensor=false

我从两个位置(距离和时间)得到响应,它工作正常,但我们需要使用 google api 的流量和没有流量详细信息。

最佳答案

https://developers.google.com/maps/documentation/distance-matrix/intro?hl=en#RequestParameters

For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).

For requests where the travel mode is driving: You can specify the departure_time to receive a route and trip duration (response field: duration_in_traffic) that take traffic conditions into account. This option is only available if the request contains a valid API key, or a valid Google Maps APIs Premium Plan client ID and signature. The departure_time must be set to the current time or some time in the future. It cannot be in the past.

traffic_model (defaults to best_guess) — Specifies the assumptions to use when calculating time in traffic. This setting affects the value returned in the duration_in_traffic field in the response, which contains the predicted time in traffic based on historical averages. The traffic_model parameter may only be specified for requests where the travel mode is driving, and where the request includes a departure_time, and only if the request includes an API key or a Google Maps APIs Premium Plan client ID. The available values for this parameter are: best_guess (default) indicates that the returned duration_in_traffic 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 departure_time is to now.

pessimistic indicates that the returned duration_in_traffic 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_in_traffic 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.

关于ios - 使用 Google API 在 iOS 中估计两个位置(纬度和经度)之间的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37404992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com