Skip to content

Multiple avoid problems #382

Open

Description

@tpchris1

Problem

When I passed the avoid parameters in the distance_matrix method, it told me that it is an invalid restriction. However, I wonder if it's possible to allow multiple avoid options like avoid=tolls|highways|ferries.
Thank you!

Environment details

  1. API: Distance_Matrix
  2. Win 10 v2004
  3. lib version: 4.4.2, Jupyter Notebook

Steps to reproduce

  1. Simply add multiple avoids in the distance_matrix parameter

Code example

# example
gmaps = googlemaps.Client(key=YOUR_KEY)
gmaps.distance_matrix(origins=SOMEPLACE,destinations=SOMEPLACE, mode='driving', avoid='tolls|highways|ferries')

Stack trace

# example
D:\Program_Files\Anaconda3\lib\site-packages\googlemaps\distance_matrix.py in distance_matrix(client, origins, destinations, mode, language, avoid, units, departure_time, arrival_time, transit_mode, transit_routing_preference, traffic_model, region)
    107     if avoid:
    108         if avoid not in ["tolls", "highways", "ferries"]:
--> 109             raise ValueError("Invalid route restriction.")
    110         params["avoid"] = avoid
    111 

ValueError: Invalid route restriction.

Activity

  1. added
    triage meI really want to be triaged.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Sep 19, 2020
  2. added
    help wantedWe'd love to have community involvement on this issue.
    priority: p3Desirable enhancement or fix. May not be included in next release.
    and removed
    triage meI really want to be triaged.
    on Jan 28, 2021
  3. removed their assignment
    on Jan 18, 2023
  4. self-assigned this
    on Jan 25, 2023
  5. wangela commented on Jan 25, 2023

    @wangela
    Member

    I've confirmed that multiple arguments are supported by Distance Matrix API, just as they are with Directions API. Getting the documentation updated to reflect that.

    I've left some review comments in #417 to hopefully get that merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedWe'd love to have community involvement on this issue.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions