Avoid service roads for trucks

Implement Using: Distance Matrix Flexible API


In this example, let’s request for distance and duration values for a route that a truck can take while avoiding service roads. We will create a Distance Matrix Flexible request with 2 origins (O) and 2 destinations (D). We set option as flexible along with:

  • setting mode to “truck” to get distance and duration values for a route that a truck can take
  • avoid option set to “service_road”

Request

1
curl --location 'https://api.nextbillion.io/distancematrix/json?origins=33.782861,-117.23477|33.3220362,-117.2358124&destinations=33.7829837,-117.2300256|33.329168,-117.24246&mode=truck&key=<your_api_key>&option=flexible&avoid=service_road'

Response

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

© 2024 NextBillion.ai all rights reserved.