Looking for a way to filter the autoplete results filtered by 2 countries, Canada and US.
Currently I can only filter by one or the other with options like this...
var options = {
types: ['(cities)'],
ponentRestrictions: {country: 'us'}
}
var autoplete = new google.maps.places.Autoplete(input,options);
... but I have not seen any documentation that explains how to restrict autoplete results to 2 countries.
Any help is appreciated.
Looking for a way to filter the autoplete results filtered by 2 countries, Canada and US.
Currently I can only filter by one or the other with options like this...
var options = {
types: ['(cities)'],
ponentRestrictions: {country: 'us'}
}
var autoplete = new google.maps.places.Autoplete(input,options);
... but I have not seen any documentation that explains how to restrict autoplete results to 2 countries.
Any help is appreciated.
Share Improve this question asked Jun 15, 2012 at 8:49 mgauthiermgauthier 3312 silver badges6 bronze badges1 Answer
Reset to default 7The Google Places API does not currently support this feature. If you believe this would be a useful feature you can submit a 'Places API - Feature Request' here.
UPDATE
This feature was introduced in version 3.27 of Maps JavaScript API in January 2017:
You can now restrict Autoplete predictions to only surface from multiple countries. You can do this by specifying up to 5 countries in the ponentRestrictions field of the AutopleteOptions.
https://developers.google./maps/documentation/javascript/releases https://developers.google./maps/documentation/javascript/reference#ComponentRestrictions