matrix
Calculate travel times and distances between multiple origins and destinations in a single request, replacing hundreds of individual route calls for efficient logistics planning.
Instructions
Calculate travel times and distances between multiple origins and destinations in a single request.
Returns: { sources: [{lat,lon}], targets: [{lat,lon}], durations: [[sec,...]], distances: [[km,...]] } durations[i][j] = travel time in seconds from origin i to destination j. distances[i][j] = distance in km from origin i to destination j.
PERFORMANCE: Always prefer matrix over calling route in a loop. One matrix call replaces N×M individual route calls. LIMITS: Up to 50 origins × 50 destinations (2500 pairs) per call. USE FOR: Nearest-store finder, multi-stop delivery planning, logistics optimization.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origins | Yes | Array of origin {lat, lon} objects. Max 50. | |
| destinations | Yes | Array of destination {lat, lon} objects. Max 50. | |
| mode | No | Travel mode. Default: auto. | |
| units | No | Distance units. Default: km. |