Shaping routes with passthrough waypoints

The example request specifies coordinates for origin, destination, and via waypoints.
The passThrough=true parameter is set for the via waypoint.

With the passThrough option set to true, the resulting route contains only one leg stretching from origin to destination, avoiding splitting into sections at the intermediate waypoint.

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'return=polyline,summary,passthrough&'\
'origin=52.51375,13.42462&'\
'destination=52.52332,13.42800&'\
'via=52.52426,13.43000!passThrough=true&'\
'apiKey=YOUR_API_KEY'
{
  "routes": [
    {
      "id": "338a34f2-60c2-4ced-b9c4-074c3c2f8039",
      "sections": [
        {
          ...,
          "summary": {
            "duration": 256,
            "length": 1970,
            "baseDuration": 256
          },
          "passthrough": [
            {
              "place": {
                "type": "place",
                "location": {
                  "lat": 52.5242323,
                  "lng": 13.4301462
                },
                "originalLocation": {
                  "lat": 52.52426,
                  "lng": 13.43
                },
                "waypoint": 0
              },
              "offset": 49
            }
          ],
          "polyline": "...",
          "transport": {
            "mode": "car"
          }
        }
      ]
    }
  ]
}

With passThrough option set to true, the router doesn't introduce a U-turn at the waypoint (1) avoiding a change in travel direction, hence resulting in a different route shape (the orange line), as shown in the image.

Route with passthrough via waypoint

Did this page help you?