Is there any way to get google maps directions from A to B with considering traffic at the moment of calling the function?
有没有办法让谷歌地图从A到B的方向考虑到调用该功能时的流量?
This code below works fine if it is empty road:
如果它是空路,下面的代码工作正常:
var gm = require("googlemaps");
gm.directions("from", "where go to" , function ( err, data ) {
console.log(data.routes[0].legs[0].distance);
console.log(data.routes[0].legs[0].duration);
}, "false");
I am new to google maps, so please any thought to spare?
我是谷歌地图的新手,所以请不要考虑任何想法?
1 个解决方案
#1
1
A quick look at the documentation gives you a clear answer:
快速浏览一下文档就会给出一个明确的答案:
durationInTraffic (optional) specifies whether the DirectionsLeg result should include a duration that takes into account current traffic conditions. This feature is only available for Maps for Business customers. The time in current traffic will only be returned if traffic information is available in the requested area.
durationInTraffic(可选)指定DirectionsLeg结果是否应包含考虑当前流量条件的持续时间。此功能仅适用于Maps for Business客户。只有在请求区域中有可用的交通信息时,才会返回当前流量的时间。
#1
1
A quick look at the documentation gives you a clear answer:
快速浏览一下文档就会给出一个明确的答案:
durationInTraffic (optional) specifies whether the DirectionsLeg result should include a duration that takes into account current traffic conditions. This feature is only available for Maps for Business customers. The time in current traffic will only be returned if traffic information is available in the requested area.
durationInTraffic(可选)指定DirectionsLeg结果是否应包含考虑当前流量条件的持续时间。此功能仅适用于Maps for Business客户。只有在请求区域中有可用的交通信息时,才会返回当前流量的时间。