Can I restrict the search to a city’s streets when using the Google Places Autocomplete?
Can I restrict the search to a city’s streets when using the Google Places
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can set the
Autocompleteoptions to usegeocodeas the type, which will restrict the results that are returned to addresses:There is no way to restrict the results to just streets, but this will largely achieve what you want. If you set
yourBoundscorrectly, maybe limited to the area of a city, it will get you as close as currently possible.Update responding to the comment:
If you want to start by entering a city, you can bind the map’s bounds to the
Autocompletes bounds, which will have the map set its viewport automatically when a city is selected in theAutocomplete:Then, you can update the
Autocomplete‘s types, similar to the above, to have it return addresses:From there, you can have a read of the Places Library API Docs.