首页 > 解决方案 > 计算路由在相同的两个地方返回不同的数字

问题描述

使用计算路线时,我在往返所述位置的相同两个位置得到不同的数字。如果它是几英里,我会理解,但我得到一些在我看来相差 20 多英里的差异。
我的查询:

https://route.api.here.com/routing/7.2/calculateroute.xml?app_id={app-id}&app_code={app-code}&mode=fastest;truck&height=5&waypoint0=geo!41.85071,-87.67896;500&waypoint1=geo!40.76282,-81.34159;500 

此查询返回

442 英里

如果我切换点:

https://route.api.here.com/routing/7.2/calculateroute.xml?app_id={app-id}&app_code={app-code}&mode=fastest;truck&height=5&waypoint0=geo!40.76282,-81.34159;500&waypoint1=geo!41.85071,-87.67896;500

此查询返回

392 英里

.

我猜我的查询中缺少一些东西,但我似乎无法弄清楚是什么。任何帮助将不胜感激。
谢谢!

标签: here-api

解决方案


你可以添加参数 truckRestrictionPenalty=soft

注意:-软惩罚要求在响应中启用路由注释

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={api_key}&mode=fastest;truck&waypoint0=geo!41.85071,-87.67896;500&waypoint1=geo!40.76282,-81.34159;500&truckRestrictionPenalty=soft&routeattributes=notes&maneuverattributes=notes

393 英里

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?mode=fastest;truck&waypoint0=geo!40.76282,-81.34159;500&waypoint1=geo!41.85071,-87.67896;500&truckRestrictionPenalty=soft&routeattributes=notes&maneuverattributes=notes&apiKey={api_key}

392 英里

https://developer.here.com/documentation/routing/dev_guide/topics/example-truck-route-violating-restriction.html


推荐阅读