Get routes for hazmat load

Implement Using: Directions Flexible API

To get routes for safely transporting hazardous material, use the hazmat_type parameter of the Directions Flexible API to avoid unsafe routes for your truck. Users need to provide the type of material that is being carried by the truck to get the legal routes as per the contents of the truck load. In this example, we will generate such a route by configuring:

  • origin & destination to to denote the starting and end locations of the trip
  • mode set to “truck” to get a route which a car can take
  • hazmat_typ parameter set to “circumstantial”
  • option set to “flexible”

Request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=34.04990727,-96.37385973&destination=34.14289606,-96.37330388&mode=truck&key=<your_api_key>&option=flexible&hazmat_type=circumstantial' \
2
--header 'Content-Type: application/json'

Response

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

Following is a visual representation of the above route on a map. We can observe that a direct route was avoided and a longer, but legal route was suggested due to the hazmat settings configured in the input request.

documentation image

© 2024 NextBillion.ai all rights reserved.