HERE Routing API-如何使用计算路线资源将publicTransportTimeTable模式与多个航路点一起使用?

时间:2019-09-10 13:48:54

标签: here-api

我正在使用calculateroute资源来计算多个航点之间的路线。

  

https://route.api.here.com/routing/7.2/calculateroute.json?app_id={APP_ID}&app_code={APP_CODE}&waypoint0=-25.4327193,-49.2806026;;0&waypoint1=-25.4392733,-49.2722581;;1&waypoint2=-25.4367652,-49.2833011;;2&waypoint3=-25.4327193,-49.2806026;;3&waypoint4=-25.4327193,-49.2806026;;4&waypoint5=-25.4392733,-49.2722581;;5&departure=2019-09-09T07:10:00-03:00&mode=fastest;car;traffic:disabled;motorway:0&improveFor=distance&language=pt-br&representation=navigation&metricSystem=metric&vehicletype=diesel,5.5

我曾经使用出发参数设置路线的初始日期,但是现在,在某些情况下,我需要使用到达时间来代替出发时间。我使用的是汽车模式,但是由于到达参数需要 publicTransportTimeTable ,因此我以此方式进行了设置。

  

https://route.api.here.com/routing/7.2/calculateroute.json?...&mode=fastest;publicTransportTimeTable;motorway:0..

然后返回此错误消息: “仅两个StopOver航点支持时间表公交路由” ,然后将waypoint0和waypoint5设置为stopOver,可以作为passThrough休息,但是,我仍然收到相同的错误。

获取请求

  

https://route.api.here.com/routing/7.2/calculateroute.json?app_id={APP_ID}&app_code={APP_CODE}&waypoint0=stopOver!-25.4327193,-49.2806026;;0&waypoint1=passThrough!-25.4392733,-49.2722581;;1&waypoint2=passThrough!-25.4367652,-49.2833011;;2&waypoint3=passThrough!-25.4327193,-49.2806026;;3&waypoint4=passThrough!-25.4327193,-49.2806026;;4&waypoint5=stopOver!-25.4392733,-49.2722581;;5&arrival=2019-09-09T07:10:00-03:00&mode=fastest;publicTransportTimeTable;motorway:0&improveFor=distance&language=pt-br&representation=navigation&metricSystem=metric&vehicletype=diesel,5.5

返回

{
    "_type": "ns2:RoutingServiceErrorType",
    "type": "ApplicationError",
    "subtype": "InvalidInputData",
    "details": "Time Table Transit Routing is only supported for two StopOver waypoints",
    "additionalData": [
        {
            "key": "waypoint",
            "value": ""
        }
    ],
    "metaInfo": {
        "timestamp": "2019-09-10T13:40:27Z",
        "mapVersion": "8.30.99.156",
        "moduleVersion": "7.2.201935-5091",
        "interfaceVersion": "2.6.68",
        "availableMapVersion": [
            "8.30.99.156"
        ]
    }
}

1 个答案:

答案 0 :(得分:0)

如文档中所述,仅当arrival设置为mode时,才能使用publicTransportTimeTable参数。目前,这种类型的路由仅支持两个中途停留航路点(waypoint0waypoint1),并且不支持直通航路点。