Avoid Highways & Tolls

Products Used: Directions API & Navigation API


Use the avoid feature in the routing APIs to ensure that your delivery vans are not taking the roads with tolls or plying on the highways with few and far between exit ramps. This can help save both time and money when traveling to delivery locations. 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 “car”
  • avoid option set to “toll” and “highway”

Directions API request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=38.94508068,-77.34270692&destination=39.31131584,-76.61936891&mode=car&key=<your_api_key>&avoid=toll|highway&overview=simplified'

Directions API response

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

Notice that if the “avoid” configuration is removed a different route is suggested in that case.

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=38.94508068,-77.34270692&destination=39.31131584,-76.61936891&mode=car&key=<your_api_key>&avoid=toll|highway&overview=simplified'
1
{
2
"status": "Ok",
3
"routes": "[...]"
4
}

Visit Directions API | Navigation API documentation to know more about the available features.

© 2024 NextBillion.ai all rights reserved.