Avoid sharp turns for a truck

Implement Using: Directions Flexible API

It gets complicated and risky for large trucks to maneuver around sharp turns. With Directions Flexible API users can specify the custom turn angles which are safe for their trucks to take. In order to use the turn_angle_range parameter, users also need to set the avoid property to “sharp_turn”. Let’s see how to configure such a request:

  • 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
  • avoid parameter set “sharp_turn”
  • turn_angle_range set to 110 to allow trucks to make turns between [110,250] degrees
  • option set to “flexible”

Request

1
curl --location 'https://api.nextbillion.io/directions/json?origin=32.75429821,-117.14624719&destination=32.75456089,-117.14694495&mode=truck&key=<your_api_key>&avoid=sharp_turn&option=flexible&turn_angle_range=110' \
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 the turn at the interchange was avoided in favor of a longer route because of the “turn_angle_range” setting.

documentation image

© 2024 NextBillion.ai all rights reserved.