Get routes suitable only for trucks

Products Used: Directions API & Navigation API


NextBillion.ai’s APIs provide mode feature which helps in avoiding roads which a truck can not take. Setting this parameter avoids the roads where a truck with default dimensions is prohibited. Please visit API documentation to know more about default truck dimensions.

Following is a request to get the directions with

  • A origin and destination set

  • mode option set to truck.

Directions API request:

1
curl --location 'https://api.nextbillion.io/directions/json?origin=34.07596589,-118.30873263&destination=34.05409546,-118.33759721&mode=truck&key=<your_api_key>'

Directions API response:

Notice that a different route is suggested when a different mode type (car) is used for the same origin and destination.

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

Following is a Navigation API request for the above scenario:

1
curl --location 'https://api.nextbillion.io/navigation/json?origin=34.07596589,-118.30873263&destination=34.05409546,-118.33759721&mode=truck&key=<your_api_key>'

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.