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 Flexible Polyline. This polyline can be easily decoded in many major languages using examples available in the Flexible Polyline respository.

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).

Example

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.378873988986015
                            },
                            "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 ""