【发布时间】:2022-02-22 21:56:47
【问题描述】:
我正在测试路由 API(https://developer.here.com/documentation/routing-api/api-reference-swagger.html),除了折线之外,一切似乎都按预期工作。
在这里我分享我的服务调用
curl --location --request GET 'https://router.hereapi.com/v8/routes?transportMode=car&origin=3.4844257,-76.5256287&destination=3.478483,-76.517984&routingMode=fast&return=elevation,polyline,actions,instructions,summary&apiKey=1234'
作为响应的一部分,我们有下一个字段:
"polyline": "B2Fkt10Grm4-xE8yTU4mBnBnG8pBAzP0tBAjD4IA_E8LAvMokBT3IkXTzF8QTnG8QTvMsiBTrJjDA3_BjXoB_sB_OAriB3NAzKjDAnLsTAnLkhBnBzKsdA_J8fTnLkcT3DwHAvC8GArJoQAnL8QA7LsTA7V0jBT_M8UA",
如您所知,折线字段已编码。 根据文档,我继续使用以下建议的库/代码对其进行解码:
https://github.com/heremaps/flexible-polyline/tree/master/java
解码字段的结果不正确。返回的点列表 (Lat,Long,Elevation) 与正确的位置不匹配。在示例中,坐标来自哥伦比亚,解码后的结果返回大西洋中部的点列表。
此外,为了放弃库问题,我正在使用其他解码器检查解码折线:
- https://developers.google.com/maps/documentation/utilities/polylineutility
- https://open-polyline-decoder.60devs.com/
结果是一样的。
所以,问题似乎出在 HereAPI 方面(API 路由 v8)
有什么想法吗?也许我以不正确的方式调用 API
【问题讨论】:
标签: rest routes here-api polyline