微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Here Maps Routing API CountrySummary Difference v7 / v8

如何解决Here Maps Routing API CountrySummary Difference v7 / v8

我目前正在使用 Routing v7 API 并希望迁移到 v8。对于我的用例,我需要一个按国家/地区分隔的路线列表,如路由 API 的 V7。

有没有一种方法可以像 v7 一样获取按国家/地区划分的查询摘要响应?

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey=xxx&jsonattributes=9&mode=balanced;truck;traffic:disabled&representation=overview&return=summary,&routeattributes=sc&truckType=truck&waypoint0=53.07537,8.80453&waypoint1=50.54226,9.75617

将返回旅行时间、距离、交通时间、国家代码、收费公路距离等信息,按国家/地区划分

cut...
""summaryByCountry": [
      {
        "distance": 343077,"trafficTime": 15125,"baseTime": 14912,"flags": [
          "tollroad","tunnel","motorway","builtUpArea"
        ],"text": "The trip takes <span class=\"length\">343 km</span> and <span class=\"time\">4:09 h</span>.","travelTime": 14912,"country": "NLD","tollRoaddistance": 341716,"_type": "RouteSummaryByCountryType"
      },{
        "distance": 169622,"trafficTime": 9080,"baseTime": 9080,"text": "The trip takes <span class=\"length\">170 km</span> and <span class=\"time\">2:31 h</span>.","travelTime": 9080,"country": "BEL","tollRoaddistance": 152117,...cut

谢谢!

解决方法

The(summaryByCountry) 在 v8 中不存在。但是,如果使用 spans=countryCode,length 请求跨度,则可以检索有关每个国家/地区的距离信息。没有计划以任何其他方式提供支持。 相同的 V8 查询示例。

https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3686&return=polyline&apiKey={your_api_key}&spans=countryCode,length

请参考以下参考文档。

迁移指南。

https://developer.here.com/documentation/routing-api/migration_guide/index.html

API 文档。

https://developer.here.com/documentation/routing-api/api-reference-swagger.html#tag%2FRouting%252Fpaths%252F~1routes%252Fget

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。