I need Google Places Autocomplete to give me results from countries: SZ, FR, DE, AT, IT. I know that componentRestrictions
can operate with only one country.
S
Be careful because if you restrict to "FR", it ignores the French overseas departments. So to have the cities in all of France, you need:
'fr', 'gp', 're', 'mq', 'gf', 'nc', 'yt', 'pf'
But since it's more than 5, it's not possible to limit to the whole of France.
Google Maps considers that the French overseas departments are not in France; this is a big problem.
Since version 3.2.7, you can use an array for componentRestrictions. Eg:
{ country: ["fr","ch","be"] }
The number of countries is, however, restricted to 5.
This feature was introduced in version 3.27 of Maps JavaScript API in January 2017:
You can now restrict Autocomplete predictions to only surface from multiple countries. 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