NicoDoerr
NicoDoerr

Reputation: 13

Google Maps API Places Autocomplete componentRestrictions Limit

Why are the componentRestrictions limited to 5. Is´nt it possible to icrease the Limit? I need 8 Countries for the Autocomplete.

Is there a workaround to increase the limit ?

You can do this by specifying up to 5 countries in the componentRestrictions field of the AutocompleteOptions.

https://developers.google.com/maps/documentation/javascript/releases#327

Upvotes: 1

Views: 576

Answers (1)

xomena
xomena

Reputation: 32128

It is explained in the original feature request that you can find at

https://issuetracker.google.com/issues/35821685#comment236

According to the Google engineering team

There is a limitation to this new feature: requests may be restricted up to 5 countries.

Please note that restricting to multiple countries comes with an increased latency. The limit of 5 countries is there to keep the latency increase in check.

So, this limit is to control the latency increase in autocomplete service.

Probably you can create bounds that include all 8 countries as a workaround and restrict autocomplete to bounds with strict bounds option.

I hope this clarifies your doubt!

Upvotes: 1

Related Questions