GuidesAPI Reference
Guides

How to calculate a bike and ride route

You request an intermodal route from Oberdorf 69, 6403 Küssnacht, Switzerland to the Culture and Congress Centre in Lucerne, using a combination of bicycle and transit transport types, a so-called Bike and Ride intermodal route.

Request

Authentication

Intermodal Routing supports authentication using both API Key and Bearer Token. To get started, join the HERE platform.

To learn more about the available authentication methods, see Identity and Access Management Developer Guide.

📘

Note

You can get started for free with the HERE Base Plan. For detailed pricing information, see HERE Location Service Rates.

Construct a Bike and Ride Route Request

GET https://intermodal.router.hereapi.com/v8/routes
    ?origin=47.082462,8.444887
    &destination=47.057296,8.299976
    &vehicle[modes]=bicycle
    &vehicle[enable]=routeHead
    &transit[enable]=routeTail
    &taxi[enable]=
    &alternatives=3
    &apiKey=<YOUR API KEY>

The only required parameters for an Intermodal Route Request in general are origin and destination, given in <latitude>,<longitude> format. For a Bike and Ride request in particular, set the parameters vehicle[modes]=bicycle, vehicle[enable]=routeHead, transit[enable]=routeTail, and taxi[enable]= to ensure the response specifies a Bike and Ride intermodal route.

The vehicle[modes]=bicycle and vehicle[enable]=routeHead parameters tell the intermodal router to return bicycle route options in the head section of the route, whereas the transit[enable]=routeTail parameter tells the intermodal router to return public transit route options in the tail section of the route. The taxi[enable]= parameter is needed to disable the taxi transport type in the response which is enabled by default.

By default, the Intermodal Routing API v8 returns only one optimal intermodal route. The optional parameter alternatives represents the number of alternative routes to return aside from the optimal route. By default, alternatives=0 is assumed and only one optimal route is returned.

In cases where also a pedestrian route is available it will be also returned. This may lead to two routes being returned in total (one intermodal route and one pedestrian route) even though only one is expected when alternatives=0 is given.

Response

A successful response contains the following details about the calculated route:

  • One optimal route divided into sections
  • Departure and arrival times, duration, coordinates, and other per-section information for each section
  • Per section, one of the following transport types:
    • vehicle - route section in which you ride from your origin to the location of transfer
    • pedestrian - route section in which you walk from the vehicle bike stand to the transit station
    • transit - route section with the public transit departure and arrival stations
      • Optionally, all intermediate stops can be returned by setting the return=intermediate request parameter.
  • A set of operators that run the services including operator code, operator name, and links to operator websites
{
    "routes": [
        {
            "id": "R006b6b-C1",
            "sections": [
                {
                    "arrival": {
                        "place": {
                            "id": "423708658",
                            "location": {
                                "lat": 47.083769,
                                "lng": 8.398502
                            },
                            "name": "Udligenswil, Neuheim",
                            "type": "station"
                        },
                        "time": "2021-09-13T22:03:00+02:00"
                    },
                    "departure": {
                        "place": {
                            "location": {
                                "lat": 47.082462,
                                "lng": 8.444887
                            },
                            "type": "place"
                        },
                        "time": "2021-09-13T21:43:00+02:00"
                    },
                    "id": "R006b6b-C1-S0",
                    "transport": {
                        "mode": "bicycle"
                    },
                    "type": "vehicle"
                },
                {
                    "agency": {
                        "id": "evT80100",
                        "name": "PostAuto AG",
                        "website": "http://www.sbb.ch/"
                    },
                    "arrival": {
                        "place": {
                            "id": "423708645",
                            "location": {
                                "lat": 47.053255,
                                "lng": 8.308895
                            },
                            "name": "Luzern, Schwanenplatz",
                            "type": "station"
                        },
                        "time": "2021-09-13T22:21:00+02:00"
                    },
                    "departure": {
                        "place": {
                            "id": "423708658",
                            "location": {
                                "lat": 47.083769,
                                "lng": 8.398502
                            },
                            "name": "Udligenswil, Neuheim",
                            "type": "station"
                        },
                        "time": "2021-09-13T22:03:00+02:00"
                    },
                    "id": "R006b6b-C1-S1",
                    "transport": {
                        "category": "Bus Service",
                        "headsign": "Luzern, Bahnhof",
                        "mode": "bus",
                        "name": "73",
                        "shortName": "73"
                    },
                    "type": "transit"
                },

                ...
                ... walk section from the arrival station to the destination
                ...

            ]
        },

        ...
        ... additional routes as requested per the alternatives parameter

    ]
}