• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

ETAs for trips in future

Implement Using: Distance Matrix Flexible API


For a Distance Matrix Flexible request with 4 origins (O) and 3 destinations (D) we will get a 4 x 3 matrix with distance and duration values for all 12 combinations (or elements) of O x D pairs. We configure the following parameters

  • option as “flexible”
  • mode set to “truck” to get distance and duration values for a route that a truck can take
  • departure_time set to a time in future

Request

1 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&mode=truck&key=<your_api_key>&option=flexible&departure_time=1685371968

Response

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

Have Questions ?