【问题标题】:Google geolocation address search returning same search exact result with partial_match = true谷歌地理位置地址搜索返回与 partial_match = true 相同的搜索确切结果
【发布时间】:2017-11-19 17:21:06
【问题描述】:

我正在使用以下请求(使用我的 google API 密钥)调用 google 地方地图 API:

https://maps.googleapis.com/maps/api/geocode/json?address=32/36+Nagle+St,+Liverpool+NSW&components=postal_code:2170|country:AU&key={你的钥匙}

它返回以下 JSON:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "32",
               "short_name" : "32",
               "types" : [ "subpremise" ]
            },
            {
               "long_name" : "36",
               "short_name" : "36",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Nagle Street",
               "short_name" : "Nagle St",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Liverpool",
               "short_name" : "Liverpool",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Liverpool City Council",
               "short_name" : "Liverpool",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "New South Wales",
               "short_name" : "NSW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Australia",
               "short_name" : "AU",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "2170",
               "short_name" : "2170",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "32/36 Nagle St, Liverpool NSW 2170, Australia",
         "geometry" : {
            "location" : {
               "lat" : -33.92853530000001,
               "lng" : 150.9219302
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : -33.92718631970851,
                  "lng" : 150.9232791802915
               },
               "southwest" : {
                  "lat" : -33.92988428029151,
                  "lng" : 150.9205812197085
               }
            }
         },
         "partial_match" : true,
         "place_id" : "Ei0zMi8zNiBOYWdsZSBTdCwgTGl2ZXJwb29sIE5TVyAyMTcwLCBBdXN0cmFsaWE",
         "types" : [ "subpremise" ]
      }
   ],
   "status" : "OK"
}

当地址作为相同的结果“部分匹配”地址传入时,为什么这里的结果有partial_match = true?

"partial_match" : true

【问题讨论】:

    标签: javascript api maps google-geocoder


    【解决方案1】:

    我相信这可能会发生,因为结果是插值的,它不是来自 Google 数据库的特征,并且位置是基于插值计算的。

    查看响应中的地点 ID。

    Ei0zMi8zNiBOYWdsZSBTdCwgTGl2ZXJwb29sIE5TVyAyMTcwLCBBdXN0cmFsaWE

    通常这些长位置 ID 对应于插值,结果被猜到了,我的假设是 API 在这种情况下设置了部分匹配标志。

    可在 Google 数据库中找到的特征通常具有较短的地点 ID。例如。 ChIJARdFFWLRhIARK6RIUxEbJ30.

    https://developers.google.com/places/place-id#id-overview

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-25
      • 1970-01-01
      • 1970-01-01
      • 2013-03-15
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      相关资源
      最近更新 更多