我目前正在使用路由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
它将返回按国家划分的travelTime、distance、trafficTime、countrycode、tollRoadDistance等信息
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
谢谢!
v8中不存在(summaryByCountry(。但是,如果请求的跨距为spans=countryCode,length,则可以检索每个国家的距离信息。没有以任何其他方式提供支持的计划。相同的V8查询示例。
https://router.hereapi.com/v8/routes?transportMode=car&原点=52.5308,13.3847&目的地=52.5264,13.33686&return=折线&apiKey={your_api_key}&spans=国家代码,长度
请参考以下参考文件。
迁移指南。
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~1路线%252F获取