-1

我目前正在使用 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,
        "flags": [
          "tollroad",
          "motorway",
          "builtUpArea"
        ],
        "text": "The trip takes <span class=\"length\">170 km</span> and <span class=\"time\">2:31 h</span>.",
        "travelTime": 9080,
        "country": "BEL",
        "tollRoadDistance": 152117,
        "_type": "RouteSummaryByCountryType"
      },
    
...cut

谢谢!

4

1 回答 1

0

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

https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3847&destination=52.5264,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

于 2021-06-21T06:01:17.153 回答