Routes for Cars & Trucks

Product Used: Directions API


NextBillion.ai’s Routing APIs provides the mode feature to determine the correct routes for a given driving mode. In case of trucks, you can further customize the suggested routes by adding truck size, truck weight and axle load constraints to ensure the safety and legitimacy of the routes. In this example, we will create requests to get suitable routes for different types of vehicles in the fleet

Vehicle Type: Pickup Truck

Following is a request to get the directions for a pickup truck with

  • An “origin” and “destination” set
  • “mode” option set to “car” to emulate driving conditions for a pickup truck
  • “avoid” option set to “highway”

Request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=28.53086731,-81.39337678&destination=28.46057639,-81.45685023&avoid=highway&mode=car&key=<your_api_key>'

Response

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

Vehicle Type: Truck

Following is a Directions Flexible request to get the directions for a freight truck with axle load settings An “origin” and “destination” set “mode” option set to “truck” to emulate driving conditions for a freight truck “truck_axle_load” configured to get legitimate routes

Request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=33.02655433,-96.75117698&destination=33.02519670,-96.88507592&mode=truck&key=<your_api_key>&option=flexible&truck_axle_load=9'

Response

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

Vehicle Type: Freight Truck

Following is a request to get the directions for a freight truck with

  • An “origin” and “destination” set
  • “mode” option set to “truck” to emulate driving conditions for a freight truck
  • “truck_size” constraints configured to get legitimate routes

Request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=29.59932895,-95.66323222&destination=29.58789146,-95.67311985&mode=truck&key=<your_api_key>&option=flexible&truck_size=220,250,400'

Response

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

Visit Directions API & documentation to know more about the available features.

© 2024 NextBillion.ai all rights reserved.