gpt4 book ai didi

google-maps - 带有路标的当前交通中的谷歌地图方向

转载 作者:行者123 更新时间:2023-12-01 12:41:55 25 4
gpt4 key购买 nike

我正在使用 google maps api 通过 durationInTraffic 选项获取路线。

var request = {
origin: start_address,
destination: end_address,
waypoints: waypts,
durationInTraffic: true,
optimizeWaypoints: true,
travelMode: tmode
};

directionsService.route(request, function(response, status) { ....

这对于没有航路点的开始和结束地址工作正常,如下所示:

Directions with Time in Current Traffic

我的问题是,当我向路线添加航路点时,“当前交通时间”估计值不再显示。

这是 API 的限制吗(我没有找到支持该限制的文档)?或者可能的修复/解决方法,因为交通信息对我的应用非常重要。

最佳答案

我向谷歌的人问了一个类似的问题,问这是否是因为我在航点中使用了 stopover = true 选项,事实确实如此。如果将中途停留设置为 false,则应返回交通持续时间。

当前文档中很少提到这一点 here

来自谷歌:

... we can't predict how long you will stop at stopovers, making it difficult to give a proper estimation for the duration_in_traffic. By using non stopover waypoints you state that you wont stop at those waypoints, thus allowing our service to estimate the duration_in_traffic of every legs.

此外,他们还提到,如果您使用 Directions Matrix API,则只有起点/目的地对计入您的配额,因此您可以发送多个请求而不会受到额外惩罚。

关于google-maps - 带有路标的当前交通中的谷歌地图方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23605262/

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