Google 地图地理编码器:返回 postal_code
我正在使用 Jquery UI 使用 Google 地图地理编码器 自动完成地址搜索,当选择一个地址时,它会返回地理编码信息。这是片段:
$('#address-dropdown').autocomplete({
//Use geocoder to fetch lat+long values from an address input using google maps API
source: function(request, response) {
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
location: item.geometry.location,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
}
}));
})
},
我需要能够返回用户“postal_code”以检查它们是否居住在允许的区域内。以下是示例输出:http://maps.googleapis.com/maps/api/geocode/json?address=1601+Main+St+Eaton+Rapids+MI+48864&sensor=false
我怎么能目标邮政编码信息?
I'm using Jquery UI to autocomplete search for an address using Google Maps Geocoder, and when an address is selected it returns the geocode information. Here is the snippet:
$('#address-dropdown').autocomplete({
//Use geocoder to fetch lat+long values from an address input using google maps API
source: function(request, response) {
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
location: item.geometry.location,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
}
}));
})
},
I need to ability to return the uses "postal_code" to check if they live within an allowable area. Here is an example output: http://maps.googleapis.com/maps/api/geocode/json?address=1601+Main+St+Eaton+Rapids+MI+48864&sensor=false
How could I target the postal_code information?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看我的例子: http://jsfiddle.net/nEKMK/
o
是你的对象。Look at my example: http://jsfiddle.net/nEKMK/
o
is your object.