Truck Routes with Weight Limits

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 legal for the given weight. Use the “truck_weight” 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=34.189973,-118.934659&destination=34.1792122,-118.9437976&mode=truck&option=flexible&truck_weight=6000'

Directions API response

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

Observe that removing the truck weight restrictions changes the route and suggests a comparatively shorter route as the vehicle is treated as a truck with default dimensions.

In case turn-by-turn restrictions are also needed 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=34.189973,-118.934659&destination=34.1792122,-118.9437976&mode=truck&option=flexible&truck_weight=6000'
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.