Features and capabilities:
A CalculateDrivingDistanceMatrix request takes a list of origins and destination locations and returns a matrix of distances and durations between them. The matrix element is the length/time of the optimal route between origin and destination points on the real road network.
Required parameters:
origins
- List of origins described as semicolon-delimited coordinate pairs with latitudes and longitudes. Max: 25 per request.Optional parameters:
destinations
- List of destinations described as semicolon-delimited coordinate pairs with latitudes and longitudes. If not specified, an n x n matrix will be generated using the origins. Max: 25 per request.start_time
- Time when travel is expected to start. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC or you can use “now” to specify the current time. The start_time must be set to the current time or some time in the future. It cannot be in the past.avoid_highways
- Avoid highways.avoid_tolls
- Avoid toll roads.avoid_ferries
- Avoid ferries.The response to the request returns a matrix of distances and durations between origins and destinations locations. Matrix rows correspond to origins and columns correspond to destinations. The response contains two-dimensional array of distances from origins to destinations “distances” and two-dimensional array of driving times(durations) from origins to destinations “durations”.
For example, for the matrix 4x4:
"origins":"40.629041,-74.025606;40.630099,-73.993521;40.644895,-74.013818;40.627177,-73.980853"
"destinations":"40.629041,-74.025606;40.630099,-73.993521;40.644895,-74.013818;40.627177,-73.980853"
{
"distances":[
0:[
0:0
1:3939
2:2077
3:5418
]
1:[
0:4004
1:0
2:2609
3:1480
]
2:[
0:2984
1:2803
2:0
3:3646
]
3:[
0:5621
1:2561
2:5170
3:0
]
]
"durations":[
0:[
0:0
1:820
2:476
3:1092
]
1:[
0:867
1:0
2:736
3:412
]
2:[
0:595
1:752
2:0
3:1030
]
3:[
0:1134
1:580
2:1184
3:0
]
]
}
From this response, we can see that the length of the route from the 2nd origin point to the 3rd destination point is 3646 m and time(duration) of the route is 1030 s.