Truck-Compliant Routes

Products Used: Directions API & Navigation API


NextBillion.ai’s APIs allows you to specify the dimensions of a truck. The routing engine then will suggest routes which are safe for the given truck dimensions. Use the “truck_size” parameter in the routing APIs to account for size based restrictions.

Let’s take a look at the following sample request with

  • A pair of “origin” & “destination” locations

  • “mode” option set to “truck”.

  • “truck_size” option set with actual truck dimensions.

  • “option” property set to “flexible”

Directions API request

1
curl --location 'https://api.nextbillion.io/directions/json?key=<your_api_key>&origin=33.16013470,-117.35264451&destination=33.15680673,-117.35078087&mode=truck&option=flexible&truck_size=213.36,300,213.36'

Directions API response

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

Observe that removing the truck size restrictions changes the route as the vehicle is treated as a truck with default dimensions.

To get turn-by-turn restrictions as well for easy navigation, users can submit the following Navigation API request for the above scenario:

1
curl --location 'https://api.nextbillion.io/navigation/json?key=<your_api_key>&origin=33.16013470,-117.35264451&destination=33.15680673,-117.35078087&mode=truck&option=flexible&truck_size=213.36,300,213.36'
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.