Google地理位置地址搜索返回与partial_match = true相同的搜索精确结果

时间:2017-06-16 20:35:21

标签: javascript api maps google-geocoder

我使用以下请求(使用我的Google API密钥)调用google place map API:

https://maps.googleapis.com/maps/api/geocode/json?address=32/36+Nagle+St,+Liverpool+NSW&components=postal_code:2170|country:AU&key= {your 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

1 个答案:

答案 0 :(得分:0)

我相信这可能会发生,因为结果是内插的,它不是谷歌数据库的功能,而且位置是根据插值计算的。

查看回复中的地点ID。

Ei0zMi8zNiBOYWdsZSBTdCwgTGl2ZXJwb29sIE5TVyAyMTcwLCBBdXN0cmFsaWE

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

可以在Google数据库中找到的功能通常具有较短的地点ID。例如。 ChIJARdFFWLRhIARK6RIUxEbJ30

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