Get Live ETAs

Product Used: Distance Matrix Flexible API


NextBillion.ai’s Distance Matrix API considers the real-time as well as historical traffic patterns to determine accurate ETAs and efficient routes. The Distance Matrix can cater to one to many and many to many scenarios as per given set of origin and destination locations. Users can also customize the request using a variety of other configurations that come along with the service.

Following is a request to get live ETAs for a fleet of pickup trucks to travel between a given set of locations

  1. A 5 X 5 set of “origins” and “destinations”
  2. “mode” option set to “car” to emulate driving conditions for a pickup trucks
  3. “route_type” option set to “fastest”

Request

curl --location 'https://api.nextbillion.io/distancematrix/json?origins=28.54557765,-81.38898523|28.54397387,-81.38506335|28.53904358,-81.38546906|28.52401369,-81.38093861|28.52662774,-81.37160723&destinations=28.52466721,-81.39270426|28.52852882,-81.39628805|28.53262792,-81.39649091|28.53940000,-81.36809106|28.54391447,-81.36984914&mode=car&key=<your_api_key>&option=flexible&route_type=fastest'

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
{
    "status": "Ok",
    "rows": [
        {
            "elements": [
                {
                    "duration": {
                        "value": 319
                    },
                    "distance": {
                        "value": 2735
                    }
                },
                {
                    "duration": {
                        "value": 297
                    },
                    "distance": {
                        "value": 2790
                    }
                },
                {
                    "duration": {
                        "value": 243
                    },
                    "distance": {
                        "value": 2288
                    }
                },
                {
                    "duration": {
                        "value": 381
                    },
                    "distance": {
                        "value": 2733
                    }
                },
                {
                    "duration": {
                        "value": 297
                    },
                    "distance": {
                        "value": 2086
                    }
                }
            ]
        },
        {
            "elements": [
                {
                    "duration": {
                        "value": 333
                    },
                    "distance": {
                        "value": 2969
                    }
                },
                {
                    "duration": {
                        "value": 315
                    },
                    "distance": {
                        "value": 2986
                    }
                },
                {
                    "duration": {
                        "value": 261
                    },
                    "distance": {
                        "value": 2484
                    }
                },
                {
                    "duration": {
                        "value": 357
                    },
                    "distance": {
                        "value": 2804
                    }
                },
                {
                    "duration": {
                        "value": 279
                    },
                    "distance": {
                        "value": 1896
                    }
                }
            ]
        },
        {
            "elements": [
                {
                    "duration": {
                        "value": 269
                    },
                    "distance": {
                        "value": 2480
                    }
                },
                {
                    "duration": {
                        "value": 254
                    },
                    "distance": {
                        "value": 2568
                    }
                },
                {
                    "duration": {
                        "value": 201
                    },
                    "distance": {
                        "value": 2066
                    }
                },
                {
                    "duration": {
                        "value": 294
                    },
                    "distance": {
                        "value": 2315
                    }
                },
                {
                    "duration": {
                        "value": 366
                    },
                    "distance": {
                        "value": 2470
                    }
                }
            ]
        },
        {
            "elements": [
                {
                    "duration": {
                        "value": 287
                    },
                    "distance": {
                        "value": 2627
                    }
                },
                {
                    "duration": {
                        "value": 341
                    },
                    "distance": {
                        "value": 2745
                    }
                },
                {
                    "duration": {
                        "value": 291
                    },
                    "distance": {
                        "value": 2517
                    }
                },
                {
                    "duration": {
                        "value": 360
                    },
                    "distance": {
                        "value": 2974
                    }
                },
                {
                    "duration": {
                        "value": 461
                    },
                    "distance": {
                        "value": 3273
                    }
                }
            ]
        },
        {
            "elements": [
                {
                    "duration": {
                        "value": 336
                    },
                    "distance": {
                        "value": 3346
                    }
                },
                {
                    "duration": {
                        "value": 423
                    },
                    "distance": {
                        "value": 4270
                    }
                },
                {
                    "duration": {
                        "value": 349
                    },
                    "distance": {
                        "value": 3035
                    }
                },
                {
                    "duration": {
                        "value": 223
                    },
                    "distance": {
                        "value": 1732
                    }
                },
                {
                    "duration": {
                        "value": 321
                    },
                    "distance": {
                        "value": 2367
                    }
                }
            ]
        }
    ]
}

Visit product documentation (Distance Matrix Fast API | Distance Matrix Flexible API) to know more about the available features.


Have Questions ?