Truck Routes for Hazardous Cargo

Products Used: Directions API & Navigation API


NextBillion.ai’s routing APIs also take into account the kind of material your trucks are transporting. Use “hazmat_type” parameter to describe the type of hazardous material that is being carried and the routing engine will only suggest the routes that are suitable for the truck to pass through. This feature ensures that the truck takes only the safe and legal routes to the destination.

Let’s take a look at the following request which makes use of

  • An “origin” and “destination” for the truck’s trip

  • “mode” option set to “truck”

  • “option” attribute set to “flexible”

  • “hazmat_type” indicating one of the recognized hazardous material types

Directions API request

1curl --location 'https://api.nextbillion.io/directions/json?key=<your_api_key>&origin=48.22539980,-101.29602541&destination=48.24027183,-101.29608570&mode=truck&option=flexible&hazmat_type=circumstantial'

Directions API response

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

Notice that if the hazmat category configuration is removed from the input request the route suggested for a general truck is quite shorter than what is safe for a truck carrying hazardous material.

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?key=<your_api_key>&origin=48.22539980,-101.29602541&destination=48.24027183,-101.29608570&mode=truck&option=flexible&hazmat_type=circumstantial'
1{
2 "status": "Ok",
3 "routes": "[...]",
4}

Visit product documentation (Directions API | Navigation API) to know more about the available features