Avoid Sharp turns and U-turns

Products Used: Directions API & Navigation API


NextBillion.ai’s routing APIs provide a powerful “avoid” parameter to configure routes to suit different business requirements of fleet management. Users can leverage the available options to avoid routing through highways, tolls, service roads and dangerous u-turns or sharp_turns. These features provide a high-degree of flexibility to serve the routing constraints of different vehicles as well as meet business requirements.

We will take a look at a couple of examples to see their impact on the suggested routes.

Avoid U turns

In this example, we will request a directions using the Directions API with

  • An “origin” and “destination” for the pick-up van trip
  • “mode” option set to “car”
  • “avoid” configuration set to “uturn”

Directions API request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=38.83377917,-77.11917420&destination=38.83397747,-77.11895667&mode=car&key=<your_api_key>&option=flexible&avoid=uturn'

Directions API response

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

Notice that if the avoid option is removed from the input request the route suggested is quite different and does go through a highway.

Avoid service roads

In this example, we will request step-by-step instructions using the Navigation API to generate a route suitable for a freight truck by avoiding any sharp turns and u-turns. We specify:

  • An “origin” and “destination”
  • “mode” option set to “truck”
  • “avoid” configuration set to “sharp_turn” and “uturn”
1
curl --location 'https://api.nextbillion.io/navigation/json?origin=33.3220362,-117.2358124&destination=33.329168,-117.24246&mode=truck&key=<your_api_key>&option=flexible&avoid=service_road'
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.