我使用 Google 地图自动完成 API 得到针对“约克郡”的意外结果。我已过滤结果以仅显示英国地区。请帮我
以下是我在搜索约克郡时得到的结果:
- 北约克郡,Royaume-Uni
- 约克郡东方, Reino Unido
- 南约克郡,统一王国
下面是代码:
<script src="http://maps.google.com/maps?file=api&v=2&key=MYGooGleAPiKey" type="text/javascript"></script><script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=places&language=en"></script><script>
$(function() {
var options = {
types: ['(regions)'],
componentRestrictions: {country: 'uk'},
region: ['(GB)']
};
var autocomplete = new google.maps.places.Autocomplete($("#txt_search")[0], options);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
//console.log(place.address_components);
});
});</script>
这似乎是 API 中的一个错误,请参阅https://code.google.com/p/gmaps-api-issues/issues/detail?id=8619 https://code.google.com/p/gmaps-api-issues/issues/detail?id=8619如果您想看到他们修复它,请加注星标。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)