Recalculate the route
Besides the update mutation, there is another way to alter the route in a navigation session. With the recalculateNavigation
mutation you can force the calculation of a new route.
Mutation
To be able to recalculate a route you need to provide the navigation id
and the current_location
. You can include the current state_of_charge
, via
points and the current heading
of the vehicle. These fields are optional but will be used to optimize the new route.
There are two use cases for this operation.
1. Deviate from the route
In case a vehicle deviates from the calculated route (e.g. the driver takes a wrong exit), most navigation SDKs will detect this. We recommend to hook into the event and send the location from the off route callback.
Do not send multiple requests but wait until the subscription returns a new route.
2. Changing the via points
The second use case for using this operation is to change the manually added via points. This allows the driver to change the order of the via points, to add new ones or to delete them. Note that via points that were already reached are eliminated automatically.
Arguments
input • non_null • NavigationRecalculateInput
Navigation recalculate input
Response
If successful, the HTTP status code in the response header is 200 and the response body contains the attributes you requested.
If unsuccessful, the header status code is an error code and the response body contains an error response object. The error response object can be any of the ones below.
Errors and warnings
NAVIGATION_TELEMETRY_INVALID
Field $TELEMETRYTYPE cannot be negative