Google maps 谷歌将自动完成澳大利亚唯一的限制
如何将Google Places限制为仅限澳大利亚 以下是我正在使用的代码:Google maps 谷歌将自动完成澳大利亚唯一的限制,google-maps,google-apps-script,Google Maps,Google Apps Script,如何将Google Places限制为仅限澳大利亚 以下是我正在使用的代码: function initialize() { var input = document.getElementById('searchTextField'); var autocomplete = new google.maps.places.Autocomplete(input); } google.maps.event.addDomListener(window, 'load', initialize)
function initialize() {
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input);
}
google.maps.event.addDomListener(window, 'load', initialize);
从:
将搜索限制在特定国家/地区
使用componentRestrictions选项将自动完成搜索限制在特定国家/地区。以下代码将结果限制在法国境内的城市
澳大利亚使用“au”:
function initialize() {
var options = {
componentRestrictions: {country: 'au'}
};
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input, options);
}
google.maps.event.addDomListener(window, 'load', initialize);
代码片段:
function initialize() {
var options = {
componentRestrictions: {country: 'au'}
};
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input, options);
}
google.maps.event.addDomListener(window, 'load', initialize);
函数初始化(){
变量选项={
组件限制:{country:'au'}
};
var input=document.getElementById('searchTextField');
var autocomplete=new google.maps.places.autocomplete(输入,选项);
}
google.maps.event.addDomListener(窗口“加载”,初始化)代码>
只需知道,您可以在Google places搜索中输入虚假地址
以19320483920489230车站街为例(任何郊区)
如果你需要地址检查服务,有更好的解决方案,Google places是快速且“脏”的,而不是快速且“干净”的数据。你能分享一个更好的解决方案吗?