From 96039e522def665a9e29a9da088b111defe231d9 Mon Sep 17 00:00:00 2001 From: shaiguelman Date: Sun, 5 Sep 2021 20:49:15 -0700 Subject: [PATCH 1/3] Fixed avoid to allow multiple avoid parameters. --- googlemaps/distance_matrix.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/googlemaps/distance_matrix.py b/googlemaps/distance_matrix.py index a30cbe09..dc18a0b1 100755 --- a/googlemaps/distance_matrix.py +++ b/googlemaps/distance_matrix.py @@ -107,8 +107,12 @@ def distance_matrix(client, origins, destinations, params["language"] = language if avoid: - if avoid not in ["tolls", "highways", "ferries"]: - raise ValueError("Invalid route restriction.") + valid_avoids = ["tolls", "highways", "ferries"] + avoid_tokens = avoid.split("|") + for token in avoid_tokens: + if token not in valid_avoids: + raise ValueError("Invalid route restriction.") + valid_avoids.remove(token) params["avoid"] = avoid if units: From a71dedb522c340c99721ecf1d99bcbfb27f06a4c Mon Sep 17 00:00:00 2001 From: shaiguelman Date: Sun, 5 Sep 2021 21:03:32 -0700 Subject: [PATCH 2/3] Changed documentation to account for change. --- googlemaps/distance_matrix.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googlemaps/distance_matrix.py b/googlemaps/distance_matrix.py index dc18a0b1..8742d5c5 100755 --- a/googlemaps/distance_matrix.py +++ b/googlemaps/distance_matrix.py @@ -51,7 +51,8 @@ def distance_matrix(client, origins, destinations, :type language: string :param avoid: Indicates that the calculated route(s) should avoid the - indicated features. Valid values are "tolls", "highways" or "ferries". + indicated features. Valid values are "tolls", "highways" or "ferries" + as well as any combination of them separated by "|". :type avoid: string :param units: Specifies the unit system to use when displaying results. From 1b286e8a963ac32ddc8925d8bc1f29d37a7d0aaa Mon Sep 17 00:00:00 2001 From: shaiguelman <42308480+shaiguelman@users.noreply.github.com> Date: Sun, 11 May 2025 00:50:17 -0700 Subject: [PATCH 3/3] Add indoor --- googlemaps/distance_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemaps/distance_matrix.py b/googlemaps/distance_matrix.py index 8742d5c5..ceeddac6 100755 --- a/googlemaps/distance_matrix.py +++ b/googlemaps/distance_matrix.py @@ -51,7 +51,7 @@ def distance_matrix(client, origins, destinations, :type language: string :param avoid: Indicates that the calculated route(s) should avoid the - indicated features. Valid values are "tolls", "highways" or "ferries" + indicated features. Valid values are "tolls", "highways", "indoor" or "ferries" as well as any combination of them separated by "|". :type avoid: string @@ -108,7 +108,7 @@ def distance_matrix(client, origins, destinations, params["language"] = language if avoid: - valid_avoids = ["tolls", "highways", "ferries"] + valid_avoids = ["tolls", "highways", "indoor", "ferries"] avoid_tokens = avoid.split("|") for token in avoid_tokens: if token not in valid_avoids: