Avoid tolls for a truck

Implement Using: Distance Matrix Fast API


In this example, we will add a 4 x 5 matrix with 4 origins and 5 destinations which would result in a total of 20 combinations (or elements) in the response with each containing distance and duration for respective combination of locations. We will also customize our request and set:

  • avoid set to “toll” to ensure routes with tolls are avoided
  • mode set to “truck” to get routes suitable for a truck

Request

1
curl --location 'https://api.nextbillion.io/distancematrix/json?origins=34.05456317,-118.31528428|33.99167000,-118.25687955|34.00792776,-118.33063151|33.94535370,-118.33148414&destinations=33.96763110,-118.23215346|33.93969502,-118.26583210|33.90184293,-118.19634326|33.93580446,-118.12173867|33.88308753,-118.32679471&mode=truck&key=<your_api_key>&avoid=toll'

Response

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

© 2024 NextBillion.ai all rights reserved.