0
votes

I'm using google maps javascript api places SearchBox with componentRestrictions settings to country cz.

But getting autocomplete with all countries.

const AUTOCOMPLETE_OPTIONS = {
 types: ['address'],
 componentRestrictions: {
    country: 'cz'
 }
};
new google.maps.places.SearchBox(inputPlaceElement, AUTOCOMPLETE_OPTIONS);

If dump created object to console componentRestrictions is set as I want but in request url there is nothing about this restriction there should be GetPredictions not GetQueryPredictions:

https://maps.googleapis.com/maps/api/js/AutocompletionService.GetQueryPredictions?1sb&4scs&15e3

I'm not sure where is problem here, if I set other country code it's not working either.

1
Turn this into an Autocomplete. As per documentation you can only bias the predictions with a LatLngBounds object. - MrUpsidown

1 Answers

3
votes

The componentRestrictions are not supported by SearchBox, this option applies to Autocomplete