Avoid Sharp Turns and U-turns

Products Used: Directions API & Navigation API


The avoid feature in NextBillion’s.ai routing APIs ensures that the trucks don’t need to take the routes with impractical u-turns or other sharp turns. This can protect against potentially dangerous maneuvers and subsequent repair costs. Depending on the information needed, users can use this feature either in NextBillion.ai’s Directions API to get desired route directions along with ETA and distance information, or they can also use Navigation API to get turn-by-turn navigation instructions as well along with other information about the route.

Following is a sample Directions API request with following parameters:

  • A pair of origin & destination locations

  • mode option set to truck

  • option property set to flexible

  • avoid option set to uturn and sharp_turn. Users can go with a single value as well.

Directions API request:

1
curl --location 'https://api.nextbillion.io/directions/json?origin=39.30420612,-76.62259137&destination=39.30386899,-76.62362166&option=flexible&mode=truck&key=<your_api_key>&avoid=uturn|sharp_turn'

Directions API response:

Notice that the Direction service suggests a route with a U-turn if the avoid parameter is not used for the given pair of origin and destination pairs.

1
{
2
"status": "Ok",
3
"routes": "[...]"
4
}

Let’s take a look at how a Navigation API call would look like for the exact same parameters as the above example.

1
curl --location 'https://api.nextbillion.io/navigation/json?origin=39.30420612,-76.62259137&destination=39.30386899,-76.62362166&option=flexible&mode=truck&key=<your_api_key>&avoid=uturn|sharp_turn'

Notice that this API only responds with the turn-by-turn navigation instructions along with ETA and distance information for a route taken while avoiding roads with tolls.

1
{
2
"status": "Ok",
3
"routes": "[...]"
4
}

Visit product documentation (Directions API | Navigation API) to know more about the available features

© 2024 NextBillion.ai all rights reserved.