2017-06-16 76 views
0

我打電話給谷歌的地方跟下面的請求地圖API(與我的谷歌API密鑰):谷歌地理位置地址搜索返回相同的搜索精確與partial_match結果=真

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 

回答

0

我認爲這可能發生,因爲結果被插值,它不是來自谷歌的數據庫功能和位置是基於插值計算。

查看回復中的地點ID。

Ei0zMi8zNiBOYWdsZSBTdCwgTGl2ZXJwb29sIE5TVyAyMTcwLCBBdXN0cmFsaWE

典型地,這些長的地方ID對應於內插,結果被猜到和我的假設是,API設置一個部分匹配標誌在這樣的情況。

可以在Google數據庫中找到的功能通常具有較短的地點ID。例如。 ChIJARdFFWLRhIARK6RIUxEbJ30

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