Route with course heading and distance at start.

In cases where a route calculation is triggered from a moving vehicle, it can be useful to add some context in the route request. Direction of travel is one such context. Since the vehicle is moving, and at speed, you can pass this as context by specifying the course parameter, along with minCourseDistance for the origin, in the request.

course accepts an integer value for angle counted clockwise, where 0 is North and 90 is East. The resulting route will try to take this into account and provide a route heading in this direction, if possible.

In the example below, the route starting from near the HERE office has the course angle specified for the origin, asking for a route heading West. Also, the minCourseDistance is specified to prevent a right turn at the junction (for example because the driver is in the wrong lane, or travelling too fast to make a turn)

Without this combination of parameters, the route will either head East towards the destination, or include a right turn at the junction.

Example

curl -X GET \
    'https://router.hereapi.com/v8/routes?origin=52.530705,13.383540;course=270;minCourseDistance=50&transportMode=car&destination=52.531839,13.390363&return=polyline,summary'
{
    "routes": [
        {
            "id": "590956f5-a13e-4e95-9522-70ae81205388",
            "sections": [
                {
                    "id": "121cb5a0-5c04-4fcf-b264-75f8b8865d68",
                    "type": "vehicle",
                    "departure": {
                        "place": {
                            "type": "place",
                            "location": {
                                "lat": 52.5307072,
                                "lng": 13.3835383,
                                "elv": 0.0
                            },
                            "originalLocation": {
                                "lat": 52.530705,
                                "lng": 13.3835399
                            }
                        }
                    },
                    "arrival": {
                        "place": {
                            "type": "place",
                            "location": {
                                "lat": 52.5318229,
                                "lng": 13.3903676,
                                "elv": 0.0
                            },
                            "originalLocation": {
                                "lat": 52.531839,
                                "lng": 13.390363
                            }
                        }
                    },
                    "summary": {
                        "duration": 234,
                        "length": 1266,
                        "baseDuration": 190
                    },
                    "polyline": "BGmhnmkDk37wZN3BvHvbvCrJzF3S_EnQ_JriBnB_ErEnQ_Ov0BzF3SzKnkB_E3NnB3D7BrEnB3IrE_OrEzPzFrTrEwC0KsiBsEkNgF4I8BsEoB4DgF4N0KokB0F4SgPw0BsEoQoBgFgKsiBgFoQ0F4SwCsJwHwbwHsd4Iof0F0U8BoGsEoQwCsJsEkSoBoG8BsJsE0U8BgK8BoLoB4IoB0KoBoLoBkNwC8a8B0UoB0UoBkNsEgtBkDsdyEwoB",
                    "transport": {
                        "mode": "car"
                    }
                }
            ]
        }
    ]
}

Screenshot

The below image shows two routes. One in purple is the route without the course parameter and the one in blue is the above example.

Route with course and minimum distance before direction change
Figure 1. Route with course and minimum distance before direction change

results matching ""

    No results matching ""