Is there any customisation available to restrict my search to a particular area or region,
I've tried using the following but had no luck:
query={{
key: 'AIz***,
language: 'en', // language of the results
radius:2,
latitude: 24.946218,
longitude:67.005615
}}
I want to restrict my search only for the places within my city, any help would be highly appreciated
Thanks
You can restrict the search by country.
Follow the code below:
query={{
// available options: https://developers.google.com/places/web-service/autocomplete
key: 'YOUR API KEY',
language: 'en', // language of the results
types: '(cities)' // default: 'geocode'
components: 'country:us'
}}
Support Link: https://developers.google.com/places/web-service/autocomplete
To me the next work:
<GooglePlacesAutocomplete
placeholder='Escribe una direcci贸n o lugar'
minLength={2}
autoFocus={true}
returnKeyType={'default'}
fetchDetails={true}
query={{
key: '***********8',
language: 'es', // language of the results
location: '20.8840744, -100.7607736',
radius: '15000', //15 km
components:'country:mx',
strictbounds: true,
}}
/>
@juliofalbo oh man, thanks for the query example. I couldn't figure out how to limit the search within a country, the documentation speaks only of the parameter that you can provide in the api call url, not as a query part.
Thanks a lot, saved me a lot of head ache.
Most helpful comment
To me the next work: