Legal routes for a given truck weight

Implement Using: Directions Flexible API

Directions Flexible API allows configuring the truck weight when making a request so that the routes returned are safe and legal for the given route to travel on. truck_weight parameter is used to eliminate routes which pass through roads with an allowed weight threshold lower than the given weight. For this request, we configure:

  • 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
  • truck_weight parameter set with the actual weight of the truck
  • option set to “flexible”

Request

1curl --location 'https://api.nextbillion.io/directions/json?origin=34.17240201,-118.38548103&destination=34.17667026,-118.36597825&mode=truck&key=<your_api_key>&option=flexible&truck_weight=11000' \
2--header 'Content-Type: application/json'

Response

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