1

Google Directions API允许我们通过提供参数来尝试避免收费&avoid=tolls

此外,我们可以尝试通过提供参数来避开高速公路&avoid=highways

我想知道如何提供避免收费和高速公路的论据?

&avoid=tolls|highways还是&avoid=tolls,highways

4

4 回答 4

2

&avoid=通行费|高速公路

在以下位置搜索“avoid=tolls|highways|ferries”: https ://developers.google.com/maps/documentation/directions/

于 2014-12-20T08:33:37.773 回答
1

I'm stuck on the "attempt to" avoid highways and tolls too. The docs clearly state "Note: the addition of restrictions does not preclude routes that include the restricted feature; it simply biases the result to more favorable routes"...so favorable = ignored arguments.

You can pass in both arguments...http://maps.google.com/maps/api/directions/xml?alternatives=true&units=imperial&avoid=tolls&avoid=highways...

Here's a link to the latest docs.... https://developers.google.com/maps/documentation/directions/

于 2012-08-22T01:04:53.753 回答
1

我遇到了同样的问题,所以我做了一些测试,看起来好像&avoid=tolls|highways是正确的用法。

从俄勒冈州波特兰到加利福尼亚州旧金山有收费站和高速公路。如果您访问 maps.google.com 并在两者之间选择不同的选项,您会发现 Google 为您提供的避开高速公路的路线与避开高速公路和收费站的路线相同。

执行 API 请求时&avoid=tolls|highways,结果与&avoid=highways|tolls.

&avoid=tolls,highways结果也没有避免。

&avoid=tolls&avoid=highways结果只能避免过路费。

这一切都让我推断,当您使用|. 但是,避开收费站和高速公路通常会导致与仅避开高速公路相同的方向。

于 2012-10-27T18:25:15.773 回答
1

目前,Google Directions API(不是客户端库)中似乎存在错误。未识别多个限制,例如&avoid=highways|tolls不工作但单做&avoid=highways&avoid=tolls

查看答案: https ://productforums.google.com/forum/#!topic/maps/WSp_qn6ou6I

我已经在 Directions API 错误跟踪器上为此打开了一个错误票,因为那里还没有 https://code.google.com/p/gmaps-api-issues/issues/detail?id=10696

于 2016-10-15T21:25:17.890 回答