经纬度可以找到邮政编码? [英] Latitude and longitude can find zip code?

查看:138
本文介绍了经纬度可以找到邮政编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google地理编码器来处理经纬度,我的问题是,有没有一种方法可以找出经纬度的邮政编码? 解决方案

我想你要找的是结果数组中的 address_components [] 。也许这样的事情会起作用,只需要输入下面的内容,这样它可能会有错误,但我认为你会明白的。

http://code.google.com/apis/maps/documentation/geocoding/#Results

 函数(请求,响应){
geocoder.geocode({'address':request.term,'latLng':centLatLng,'region' :'US'},function(results,status){
response($。map(results,function(item){
return {
item.address_components.postal_code; // This is你想要看什么
}
}


I am using Google geocoder for lat and lon and my question is, is there a way you can find out zipcode with latitude and longitude?

解决方案

I think what you are looking for is the address_components[] in the results array. Maybe something like this would work, just typing the below so it might have errors in it but I think you will get the idea.

http://code.google.com/apis/maps/documentation/geocoding/#Results

function (request, response) {
  geocoder.geocode({ 'address': request.term, 'latLng': centLatLng, 'region': 'US' }, function (results, status) {
    response($.map(results, function (item) {
      return {
       item.address_components.postal_code;//This is what you want to look at
      }
}

这篇关于经纬度可以找到邮政编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆