here-api - Calculate Route keeps ploting not the shortest route
问题描述
I'm using HERE's calculate route API to present routes on the map. In a few places, I keep getting results that led me here as I am seemingly unable to achieve reasonable results. Near Warsaw, my route keeps turning to the north towards the city just to turn south-west that is back in the main direction whereas there is a straight road that would allow achieving the same. My users expect routes to be as straight as possible and I am not able to defend nor explain such deviations as this in route plotting.
Request parameteres:
url: 'https://route.api.here.com/routing/7.2/calculateroute.json',
method: 'get',
params:
{ app_id: 'is-it-possible-to-learn-this-power-?',
app_code: 'not-from-a-jedi',
mode:
'fastest;truck;traffic:disabled;tollroad:0,motorway:0,boatFerry:0,tunnel:0,dirtRoad:0,park:0',
waypoint0: '54.11025,22.96542',
waypoint1: '49.19168,16.65446',
waypoint2: '49.59958,17.26838',
avoidSeasonalClosures: true,
language: 'pl-pl',
excludeCountries: 'CHE,DEU',
metricSystem: 'metric',
legAttributes: 'length,travelTime',
jsonAttributes: 9,
routeAttributes: 'shape,legs',
limitedWeight: 40 }
}
It is worth noting that at first I was convinced that I get this result because of the traffic settings, but it turn out no matter which option (concerning traffic) do I choose I always end up with what it look like the same route shape.
My question is: is there a way to achieve a straight route without detours such as this in my example or maybe this is totally acceptable route but I am unaware of the reason?
解决方案
这个问题的解决方案是软排除高速公路并避免季节性关闭,因为在华沙和弗罗茨瓦夫附近有一些。
现在请求参数如下所示:
{ app_id: 'i-am-the-senate',
app_code: 'not-yet',
mode: 'fastest;truck;motorway:-2',
waypoint0: '54.11025,22.96542',
waypoint1: '49.19168,16.65446',
waypoint2: '49.59958,17.26838',
avoidSeasonalClosures: true,
avoidAreas: '53.204942,23.05379;53.100605,23.254131',
excludeCountries: 'CHE,DEU',
legAttributes: 'length,travelTime',
jsonAttributes: 9,
routeAttributes: 'shape,legs',
limitedWeight: 40 }
排除区域是比亚韦斯托克市附近和北部的道路,因为这条道路不是最佳的。
推荐阅读
- jquery - 如何获取数据表“标题名称”
- elasticsearch - 如何查询包含具有至少一个多边形匹配地理形状过滤器的多边形数组的文档?
- css - 具有固定背景图像 css 的圆形动画
- libgdx - box2d 中的软约束是什么?
- apache-spark - 有没有办法根据 pyspark 中的索引对数据帧进行切片?
- c# - 如何在不单击按钮的情况下直接使用 RadioButtons 和 CheckBoxes 输出到 TexBox
- android - 为什么 IncomingNumber 总是空的?
- javascript - Angular 2 表单验证触碰和脏返回错误,找不到原因
- c# - System.ObservableExtensions.Subscribe:不明确的引用
- azure-cognitive-services - Azure 认知服务 RecognizePrintedText 与 RecognizeText