我一直在使用下面的代码,这个代码在一个星期左右的时间里工作正常,我已经回过头来进一步研究它,它似乎不再有效。我只想向当地人展示。看一下Google的文档“locality”是正确的选择。我在想,也许谷歌改变了API或什么。只要我切换到地理编码它的作品,但显示所有的街道和地方,这不是我想要的。我也试过[“地方”,“政治”],也没有运气。我在这里做错了什么?谷歌地方的v3 API自动完成 - 不能让地方工作?
<script type="text/javascript">
function initialize() {
var input = document.getElementById('searchTextField');
var Newoptions = {
types: ["locality"]
};
var autocomplete = new google.maps.places.Autocomplete(input,Newoptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<input id="searchTextField" name="member_location" value="" type="text" >
但是它为什么如此呢?是因为Google Maps API不知道/定义该地理区域的地点像新加坡的国家? – ericn