Get route shape

To obtain the shape of a route, specify return=polyline in your route request.

This will result in a polyline field in each section. This polyline is encoded using a flexible polyline. You can encode this polyline easily in many major languages using examples available in the flexible polyline repository.

The decoded polyline will be a series of coordinates that you can use for rendering the route, for example using the Maps API for Javascript.

curl -X GET \
  'https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3847&destination=52.5323,13.3789&return=polyline'
{
  "routes": [
    {
      "id": "81e526c0-5693-4bc0-bdbb-239ecc2857e7",
      "sections": [
        {
          "arrival": {
            "place": {
              "location": {
                "lat": 52.53232637420297,
                "lng": 13.378873988986016
              },
              "type": "place"
            },
            "time": "2019-12-09T11:15:43+01:00"
          },
          "departure": {
            "place": {
              "location": {
                "lat": 52.53098367713392,
                "lng": 13.384566977620125
              },
              "type": "place"
            },
            "time": "2019-12-09T11:13:51+01:00"
          },
          "id": "3b64cfbf-4a78-487b-ab37-0676b06d2456",
          "polyline": "BGwynmkDu39wZvBtFAA3InfAAvHrdAAvHvbAAoGzF0FnGoGvHsOvRAA8L3NAAkSnVAAoGjIsEzFAAgFvHkDrJAAwHrJoVvb0ezoBAAjInVAA3N_iBAAzJ_Z",
          "transport": {
            "mode": "car"
          },
          "type": "vehicle"
        }
      ]
    }
  ]
}

results matching ""

    No results matching ""