|
24 | 24 | def distance_matrix(client, origins, destinations, |
25 | 25 | mode=None, language=None, avoid=None, units=None, |
26 | 26 | departure_time=None, arrival_time=None, transit_mode=None, |
27 | | - transit_routing_preference=None, traffic_model=None): |
| 27 | + transit_routing_preference=None, traffic_model=None, region=None): |
28 | 28 | """ Gets travel distance and time for a matrix of origins and destinations. |
29 | 29 |
|
30 | 30 | :param origins: One or more locations and/or latitude/longitude values, |
@@ -81,6 +81,11 @@ def distance_matrix(client, origins, destinations, |
81 | 81 | the travel mode is driving, and where the request includes a |
82 | 82 | departure_time. |
83 | 83 |
|
| 84 | + :param region: Specifies the prefered region the geocoder should search |
| 85 | + first, but it will not restrict the results to only this region. Valid |
| 86 | + values are a ccTLD code. |
| 87 | + :type region: string |
| 88 | +
|
84 | 89 | :rtype: matrix of distances. Results are returned in rows, each row |
85 | 90 | containing one origin paired with each destination. |
86 | 91 | """ |
@@ -127,4 +132,7 @@ def distance_matrix(client, origins, destinations, |
127 | 132 | if traffic_model: |
128 | 133 | params["traffic_model"] = traffic_model |
129 | 134 |
|
| 135 | + if region: |
| 136 | + params["region"] = region |
| 137 | + |
130 | 138 | return client._request("/maps/api/distancematrix/json", params) |
0 commit comments