Here.com路由API - V8 -状态里程



我们正在尝试从路由v7迁移到路由v8。使用v8,我们如何得到每个美国州的里程数细分?

在7.2版本中我们可以做

https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey=API_KEY&模式=最快;truck& excludecountries =墨西哥人,可以;metricSystem = imperial& routeattributes = sm, sc& instructionFormat = text& truckType = tractorTruck& trailersCount = 1, waypoint0 =地理! 33.90251,-81.13206,waypoint1 =地理!

39.80203, -105.08759各州代码将在summaryByCountry元素中:

"summaryByCountry": [
{
"distance": 189887,
"trafficTime": 8239,
"baseTime": 8206,
"flags": [
"motorway",
"builtUpArea"
],
"text": "The trip takes 118 mi and 2:17 h.",
"travelTime": 8206,
"country": "South Carolina",
"_type": "RouteSummaryByCountryType"
},
...

在版本8中,类似的请求:

https://router.hereapi.com/v8/routes?apiKey=API_KEY&起源= 32.20618、-110.96474,目的地= 40.391537,-104.681168,routingMode = fast&运输方式= truck&避免[功能]= ferry&排除(国家)=墨西哥人,可以,单位= imperial&回报=折线,总结,行动,instructions&跨越= countryCode,长度,truckAttributes, notices&卡车(trailerCount) = 1,通过= 40.014984、-105.270546

"spans": [
{
"offset": 0,
"truckAttributes": [
"open"
],
"length": 1460740,
"countryCode": "USA"
},
{
"offset": 14050,
"truckAttributes": [
"open",
"tollRoad"
],
"length": 272,
"countryCode": "USA"
},
{
"offset": 14053,
"truckAttributes": [
"open"
],
"length": 23153,
"countryCode": "USA"
}

v7: summaryByCountry
v8:不存在。如果使用span =countryCode,length请求跨度,则可以检索每个国家的距离信息。没有计划以任何其他方式提供支持。v8中的响应包含:

spans": [
{
"offset": 0,
"truckAttributes": [
"open"
],
"length": 76817,
"countryCode": "USA"
}
],

迁移指南链接:https://developer.here.com/documentation/routing-api/migration_guide/index.html