【问题标题】:Wrong LAT/LNG returned by APIAPI 返回错误的 LAT/LNG
【发布时间】:2016-04-07 14:18:12
【问题描述】:

当我尝试根据地址获取 lat/lng 位置时,JSON 返回的坐标错误。

API 链接:http://maps.google.com/maps/api/geocode/json?address=Av.+Major+Williams,+1132+Boa+Vista+RR+Brazil&sensor=false

JSON:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Boa Vista",
               "short_name" : "Boa Vista",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Boa Vista",
               "short_name" : "Boa Vista",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Roraima",
               "short_name" : "RR",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Brasil",
               "short_name" : "BR",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Boa Vista, Boa Vista - RR, Brasil",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 2.8686558,
                  "lng" : -60.6236814
               },
               "southwest" : {
                  "lat" : 2.7457422,
                  "lng" : -60.7694416
               }
            },
            "location" : {
               "lat" : 2.8235098,
               "lng" : -60.6758331
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 2.8686558,
                  "lng" : -60.6236814
               },
               "southwest" : {
                  "lat" : 2.7457422,
                  "lng" : -60.7694416
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJ26Sqy8oFk40RRV_XqcdlLrc",
         "types" : [ "locality", "political" ]
      }
   ],
   "status" : "OK"
}

如果我在 Google 地图上设置地址“Av. Major Williams, 1132 Boa Vista RR Brasil”,则位置正确:lat 2.8291068, lng -60.6711494

【问题讨论】:

    标签: google-maps google-maps-api-3 maps coordinates


    【解决方案1】:

    您的搜索未使用地理编码产生街道地址匹配。你的 JSON 表明它找到了它所能找到的最小的东西,那就是一个地方。

    Google 地图的搜索与地理编码不同。

    https://developers.google.com/maps/documentation/geocoding/intro

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 2018-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多