此处 API 计算路线 - 避免任何改变路由器行为

HERE API Calculate Route - avoid anything changes router behavior

问题

如果您选择在请求路由器中使用 avoidAreaexclueCountriesavoidLinks(可能还有一些我无法测试的),则强制执行 fastest 路线模式。

给出的是从波兰到德国的路线。

官方测试客户端:http://refclient.ext.here.com/

第一个请求(不避免,不排除,模式:shortest)是:

https://route.api.here.com/routing/7.2/calculateroute.json?app_code=pxIXqdtgOSwQDXSDfjLQpw&app_id=cgZPrYfgRePXzXC3PbBp&jsonattributes=41&language=en-us&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167

这导致了一条非常简单的路线,如下所示。

如果我们现在添加任何国家/地区排除项(例如 GBR、CHE、CZE),路线现在会通过高速公路,例如强制执行 fastest 模式。

https://route.api.here.com/routing/7.2/calculateroute.json?app_code=pxIXqdtgOSwQDXSDfjLQpw&app_id=cgZPrYfgRePXzXC3PbBp&avoidseasonalclosures=false&excludecountries=CHE,GBR,CZE&jsonattributes=41&language=pl-pl&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh,zo&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167

编辑 1 开始

我检查了新路由 API,结果类似:

无忌:

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={API_KEY}=41&language=en-us&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167

避免:

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={API_KEY}&avoidseasonalclosures=false&excludecountries=CHE,GBR,CZE&jsonattributes=41&language=pl-pl&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh,zo&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167

旁注,http://refclient.ext.here.com/ 没有测试新 API

的选项

编辑 1 结束

问题

为什么会这样?它是设计行为吗?如果没有,我们什么时候可以修复这个问题?

好的,我从工程师那里得到了答案。我改写了一下,所以 mistakes/confusion 都怪我,而不是他。 :)

所以是的,这里的 API 忽略了您使用最短的请求。

引用开发者:具体在这​​种情况下,当使用"shortest"模式并请求额外"avoids"时,超过300公里左右的路线不是"good"。它不会退回到 "fastest" 模式,而是 "fastest" 路线形状有更大影响的另一种模式。

您提到要避免过路费,请注意,您可以在致电 API 时要求该选项,因此这可能是适合您的解决方案。

希望对您有所帮助,感谢您的耐心等待。