首页 > 解决方案 > 使用 Fleet Telematics API 和 vehicleType BUS 获取 Toll 和 KM 的摘要(按国家和收费系统)

问题描述

目前,我们使用 HERE 服务的主要目的是获取每个国家的公里数,以及车辆路线的成本价格(按国家、收费系统等汇总的所有类型的通行费的成本)。

在大多数情况下,我们已经弄清楚如何通过调用 Fleet-telematics API ( https://developer.here.com/documentation/fleet-telematics/api-reference.html , http ://cre.api.here.com/swagger-ui.html?app_id=%7Byour-app-id%7D&app_code=%7Byour-app-code%7D#!/Routing_%26_Route_Matching/calculateRouteUsingPOST

), 经过

我们主要关注公共汽车(和一些汽车)。但是,我们似乎必须使用“TRUCK”而不是“BUS”作为“车辆类型”,否则我们会从您的 API 端点收到错误(“错误请求”-http 状态 400)。

让我举个例子。

用卡车:

https://fleet.ls.hereapi.com/2/calculateroute.json?
apiKey=(REPLACE-API-KEY)
&mode=fastest;truck;traffic:disabled
&departure=2020-07-15T12:00:00
&alternatives=0
&currency=EUR
&tollVehicleType=3
&waypoint0=46.057745,14.507342
&waypoint1=stopOver!46.232389,15.262164
&waypoint2=stopOver!46.562957,15.638413
&waypoint3=stopOver!47.481128,18.99022
&waypoint4=50.066885,14.380644
&legAttributes=sm
&maneuverAttributes=none
&routeAttributes=none,wp,sm,sc
&linkAttributes=none
&cost_optimize=0
&detail=1
&rollup=none,country;tollsys

坐车:

https://fleet.ls.hereapi.com/2/calculateroute.json?
apiKey=(REPLACE-API-KEY)
&mode=fastest;car;traffic:disabled
&departure=2020-07-15T12:00:00
&alternatives=0
&currency=EUR
&tollVehicleType=2
&waypoint0=46.057745,14.507342
&waypoint1=stopOver!46.232389,15.262164
&waypoint2=stopOver!46.562957,15.638413
&waypoint3=stopOver!47.481128,18.99022
&waypoint4=50.066885,14.380644
&legAttributes=sm
&maneuverAttributes=none
&routeAttributes=none,wp,sm,sc
&linkAttributes=none
&cost_optimize=0
&detail=1
&rollup=none,country;tollsys

坐巴士:

https://fleet.ls.hereapi.com/2/calculateroute.json?
apiKey=(REPLACE-API-KEY)
&mode=fastest;bus;traffic:disabled
&departure=2020-07-15T12:00:00
&alternatives=0
&currency=EUR
&tollVehicleType=2
&waypoint0=46.057745,14.507342
&waypoint1=stopOver!46.232389,15.262164
&waypoint2=stopOver!46.562957,15.638413
&waypoint3=stopOver!47.481128,18.99022
&waypoint4=50.066885,14.380644
&legAttributes=sm
&maneuverAttributes=none
&routeAttributes=none,wp,sm,sc
&linkAttributes=none
&cost_optimize=0
&detail=1
&rollup=none,country;tollsys

所有三个 URL(请求)之间的唯一区别是查询参数“mode”和“tollVehicleType”。

当我们在查询参数“mode”中使用“TRUCK”和“CAR”时,答案是可以的(http 状态 200),但是对于“BUS”,我们得到以下错误:

{ "issues": [ { "message": "Router returned no route, error: 400 : {\"_type\":\"ns2:RoutingServiceErrorType\",\"type\":\"ApplicationError\",\"subtype\":\"InvalidInputData\",\"details\":\"Invalid input parameter value\",\"additionalData\":[{\"key\":\"mode\",\"value\":\"fastest;bus;traffic:disabled\"}],\"metaInfo\":{\"timestamp\":\"2020-08-03T08:35:34Z\",\"mapVersion\":\"8.30.111.150\",\"moduleVersion\":\"7.2.202030-7513\",\"interfaceVersion\":\"2.6.76\",\"availableMapVersion\":[\"8.30.111.150\"]}}\n" }, { "message": "Request id: 360cf8bf-a542-4fa9-9198-436cf1c9dbfd" } ], "error_id": "360cf8bf-a542-4fa9-9198-436cf1c9dbfd", "response_code": "400 Bad Request" }

只有当我们完全删除查询参数“rollup”时,我们才能得到“BUS”的 OK 响应。但是这样做,我们丢失了我们真正需要的所有信息(见第 1 段)。

一个额外的相关问题。使用“TRUCK”作为“车辆类型”和“6”(“BUS”)作为“tollVehicleType”或通过查询参数“mode”使用“BUS”作为“车辆类型”之间的主要区别是什么*?

* - 我假设通过使用“TRUCK”(作为“车辆类型”)和“BUS”(“6”)作为“tollVehicleType”,您可能只删除与公共汽车相关的通行费(例如,德国没有通行费高速公路/高速公路,但有卡车),但其他一切(如法规)都与卡车密切相关。另一方面,通过将“BUS”用作“车辆类型”,您可能还考虑了欧盟和其他与 BUS 相关的法规(以及城市限制,例如禁止卡车而不是公共汽车)。这对我们来说是非常重要的功能 - 正确规划路线。

一般来说,在公开可用的文档中,实际上并没有太多与 BUS 类别(作为“车辆类型”)相关的描述或示例。如果您有任何可以分享的内部出版物,我们将非常高兴。

标签: here-api

解决方案


推荐阅读