maps_distance_matrix
Calculate travel time and distance for multiple origins and destinations. Identify the closest depot to each customer or rank route options with results referencing your input arrays.
Instructions
Travel time and distance for every origin-destination pair, e.g. which of five depots is closest to a customer. Results carry originIndex and destinationIndex pointing back at the input arrays, and are not necessarily in order. Limit is 625 elements (origins x destinations), 100 for TRANSIT or TRAFFIC_AWARE_OPTIMAL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| units | No | Units, default METRIC. | |
| origins | Yes | Start points. Each one: Address ("Bern main station"), coordinates ("46.9480,7.4474") or a place ID ("place_id:ChIJ..."). | |
| avoid_tolls | No | Avoid toll roads (motorised modes only). | |
| region_code | No | CLDR region code, e.g. "CH". | |
| travel_mode | No | Travel mode, default DRIVE. | |
| destinations | Yes | End points. Each one: Address ("Bern main station"), coordinates ("46.9480,7.4474") or a place ID ("place_id:ChIJ..."). | |
| avoid_ferries | No | Avoid ferries (motorised modes only). | |
| language_code | No | ISO 639 language code, e.g. "de". | |
| avoid_highways | No | Avoid highways (motorised modes only). | |
| departure_time | No | RFC 3339 UTC timestamp, e.g. "2026-08-13T07:30:00Z". Must be in the future. | |
| routing_preference | No | Traffic handling for DRIVE and TWO_WHEELER, default TRAFFIC_AWARE. |