admin管理员组文章数量:1425036
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
本文标签: javascriptGoogle Places Autocomplete API filter by multiple countriesStack Overflow
版权声明:本文标题:javascript - Google Places Autocomplete API filter by multiple countries - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745391599a2656621.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论