仅将Google地图自动完成功能限制为英国地址 [英] limiting google maps autocomplete to UK address only
本文介绍了仅将Google地图自动完成功能限制为英国地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在看例子:
http://code.google.com/apis/maps/documentation/javascript/examples/places-autocomplete.html
,并决定将其加入我的网站。
and have decided to incorporate it into my site.
是否可以将地址限制为英国地址?
Is it possible to limit the addresses to UK addresses only?
推荐答案
试试这个:
Try this:
var input = document.getElementById('searchTextField');
var options = {
types: ['(cities)'],
componentRestrictions: {country: 'tr'}//Turkey only
};
var autocomplete = new google.maps.places.Autocomplete(input,options);
这篇关于仅将Google地图自动完成功能限制为英国地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文