• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

ETAs for custom truck dimensions

Implement Using: Distance Matrix Flexible API


In this example, we take a 3 x 3 matrix with 3 origins and 3 destinations which would result in a total of 9 combinations (or elements) in the response. We will also customize our request and set:

  • mode to truck
  • truck_size to truck height,width,length in centimeters (cm). This defines the dimensions of a truck.
  • truck_weight set with the total weight of the truck including the weight of trailer and shipped goods in kilograms (kg).
  • departure_time to indicate the time when the trip starts

Request

1curl --location 'https://api.nextbillion.io/distancematrix/json?key=<your_api_key>&origins=34.189973,-118.934659|34.19099901,-118.92534671|34.20453867,-118.92889235&destinations=34.1792122,-118.9437976|34.17209339,-118.93331971|34.17933722,-118.94442264&mode=truck&truck_size=200,210,600&truck_weight=11770&avoid=toll&option=flexible&departure_time=1715082600'

Response

1{
2 "status": "Ok",
3 "rows": [
4 {
5 "elements": [
6 {
7 "duration": {
8 "value": 1178
9 },
10 "distance": {
11 "value": 23707
12 }
13 },
14 {
15 "duration": {
16 "value": 1321
17 },
18 "distance": {

Have Questions ?