我知道durationIntraffic现在已经被删除了。 我只是找不到使用谷歌api获得没有流量的持续时间的方法。 已经使用DrivingOptions和trafficModel尝试了矩阵,但是持续时间和duration_in_traffic与Maps.Google.com中没有流量的持续时间不匹配
有关如何使用API获取没有流量数据的持续时间的任何帮助吗?
答案 0 :(得分:0)
根据this,Google Maps API应返回名为duration的元素以及名为duration_in_traffic的元素。持续时间将是没有流量的时间,而duration_in_traffic是交通状况的时间。
答案 1 :(得分:0)
Just to set the correct expectations, you shouldn't expect the Web Services API and the Google Maps website to work in the exact same way. These are different products managed by different teams at Google. The search stack is also different, so results may differ.
The result you get in duration field is an approximation of the average travel time for the route. This takes into account average traffic conditions of the last several weeks for a time when you execute a request. That means that the duration can change during the day.
Applying the departure time and traffic_model you can add further information to your requests to get the travel time in the current traffic, this will be provided in a duration_in_traffic field.
Resuming, currently there is no way to get duration without traffic. You will get the average travel time via the API.
答案 2 :(得分:0)
持续时间给出流量的平均时间和持续时间给出了流量的时间。有时你在中途运行googleApi,你会发现交通时间的持续时间小于持续时间意味着持续时间不是没有交通时间。