简体   繁体   English

计算两点之间的持续时间时,Google API for distance 不考虑流量

[英]Google API for distance doesn't consider traffic when calculate time duration between two points

As it is mentioned on The Google Maps Distance Matrix API - departure time is used to receive trip duration considering current traffic conditions.正如谷歌地图距离矩阵 API 中提到的那样 - 考虑当前交通状况,出发时间用于接收行程持续时间。

I tried to get time between points in different days for example: Fri, 02 Oct 2015 14:10:45 GMT Friday Calculation and in the response duration is 22 min我试图在不同的日子里获取时间点之间的时间,例如:2015 年 10 月 2 日星期五14:10:45 GMT Friday Calculation and in response duration is 22 min

When I set date with less traffic Sun, 04 Oct 2015 01:10:45 GMT Sunday Calculation the response duration is again 22min.当我设置交通较少的日期时,Sun, 04 Oct 2015 01:10:45 GMT Sunday Calculation响应持续时间再次为 22 分钟。

I think the time durations should be different if in calculations are considered current traffic!如果在计算中考虑当前流量,我认为持续时间应该不同!

Just set departure_time=now in your query options.只需在您的查询选项中设置departure_time=now note now shouldn't be specified as a timestamp.注意now不应指定为时间戳。 You will see a response with duration_in_traffic as a child to the elements tag or keyword您将看到一个将duration_in_traffic作为元素标记或关键字的子项的响应

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM