Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter results by country? #6

Open
ryanmwc opened this issue Feb 22, 2020 · 7 comments · May be fixed by #16
Open

Filter results by country? #6

ryanmwc opened this issue Feb 22, 2020 · 7 comments · May be fixed by #16

Comments

@ryanmwc
Copy link

ryanmwc commented Feb 22, 2020

I don't see anywhere in your docs on how to filter results by country. Do you not have this set up as a prop?

@Braunmann
Copy link

In vue-place-autocomplete/src/PlaceAutocompleteField.vue line 306 is:

        // can be used to restrict results to specific groups. Currently, you can use componentRestrictions to filter by up to 5 countries. Countries must be passed as as a two-character, ISO 3166-1 Alpha-2 compatible country code. Multiple countries must be passed as a list of country codes. z
        componentRestrictions: undefined,

Unfortunetly I do not know how to use this.

@trasigor
Copy link

This should works:

<place-autocomplete-field
          :api-key="**********"
          :component-restrictions='{country: ["us", "de"]}'
></place-autocomplete-field >

@mattg1995
Copy link

This should works:

<place-autocomplete-field
          :api-key="**********"
          :component-restrictions='{country: ["us", "de"]}'
></place-autocomplete-field >

This doesn't seem to work for me at all, I can see the restrictions being applied to the component but it is still not filtering the results

@Chup4Chups
Copy link

Do you have any workaround to filter the results by country ?
Also, is there any plan to get same feature to filter zipCode or City ?

@NWBY
Copy link

NWBY commented Sep 15, 2020

Anyone found a solution to this yet?

@CSalih
Copy link

CSalih commented Oct 23, 2020

:component-restrictions='{country: ["AT", "de", "ch", "it"]}'
:libraries="['geometry', 'places', '&language=at&region=AT']"

Doing this will not restrict to these country's. I add a region in libraries and the result will now prioritized to the country's within component-restrictions.
Not the best solution but can used till this will fixed.

@CSalih CSalih linked a pull request Nov 12, 2020 that will close this issue
@gbrits
Copy link

gbrits commented Nov 25, 2020

🥳 Using the suggested solution by @CSalih worked great for me. I needed to restrict to addresses in Australia, with the following:

:component-restrictions='{country: ["AU"]}'
:libraries="['geometry', 'places', '&language=EN&region=AU']"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants