Search code examples
here-api

HERE Routing API - How to use publicTransportTimeTable mode with multiple waypoints using calculate route resource?


I'm using calculateroute resource to calculate a route between multiple waypoints.

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

I was using departure parameter to set the initial date of the route, but now, instead of departure, I need to use arrival time in some cases. I was using car mode, but as arrival parameter requires publicTransportTimeTable, I set it this way.

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

Then the return was this error message: "Time Table Transit Routing is only supported for two StopOver waypoints", then I set the waypoint0 and waypoint5 as stopOver and the rest as passThrough, and yet, I receive the same error.

GET REQUEST

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

RETURN

{
    "_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"
        ]
    }
}

Solution

  • as stated in the documentation, you can only use the arrival parameter when mode is set to publicTransportTimeTable. And this type of routing currently supports only two stopover waypoints (waypoint0 and waypoint1) and no passthrough waypoints.