2016-12-14 65 views
1

今天,12月14日,我查詢谷歌地圖API(https://maps.googleapis.com/maps/api/geocode/json)與許多地址,我得到的一切,像sublocality或地方的地址組件,但沒有對附近位置的類型,出的20個查詢。谷歌地圖API不給我回了附近

以下是第一個結果,我得到的一個例子,當我查詢該地址:694 rue Saint-Vallier O, Québec (Québec) G1N1C8

{:address-components 
({:long-name "694", :short-name "694", :types ("street_number")} 
    {:long-name "Rue Saint-Vallier Ouest", :short-name "Rue Saint-Vallier O", :types ("route")} 
    {:long-name "La Cité-Limoilou", :short-name "La Cité-Limoilou", :types ("political" "sublocality" "sublocality_level_1")} 
    {:long-name "Ville de Québec", :short-name "Ville de Québec", :types ("locality" "political")} 
    {:long-name "Communauté-Urbaine-de-Québec", :short-name "Communauté-Urbaine-de-Québec", :types ("administrative_area_level_2" "political")} 
    {:long-name "Québec", :short-name "QC", :types ("administrative_area_level_1" "political")} 
    {:long-name "Canada", :short-name "CA", :types ("country" "political")} 
    {:long-name "G1N 1C8", :short-name "G1N 1C8", :types ("postal_code")}), 
:formatted-address "694 Rue Saint-Vallier O, Ville de Québec, QC G1N 1C8, Canada", 
:geometry {:location {:lat 46.8095334, :lng -71.2466119}, 
      :location-type "ROOFTOP", 
      :viewport {:northeast {:lat 46.8108823802915, :lng -71.24526291970851}, 
         :southwest {:lat 46.8081844197085, :lng -71.24796088029152}}}, 
:place-id "ChIJyeeRiF2WuEwRSkuyr-3-zCQ", :types ("street_address")} 

在地址組件列表中,我通常也得到類似: {:long-name "Saint-Sauveur", :short-name "Saint-Sauveur", :types ("political" "neighborhood")}

回答

4

它確實關係到update to the Geocoding API的部署。

地址組件現在更依賴於每個地理編碼的結果,並且只包括那些相關的地址格式。預計這將是一個漸變,需要一些時間。

這僅適用於街道地址,包括建築物和興趣點。如果您需要額外的地址組件,則反向地理編碼是獲得可靠信息的最佳方式。

例如,檢查出來使用Geocoder Tool

+1

另請參閱https://code.google.com/p/gmaps-api-issues/issues/detail?id=11070─您可能希望提出一項新功能請求,要求在加拿大返回「鄰居」。 – miguev

2

谷歌推出了一個更新,以每this blog post

地址解析器從the post

地理編碼API的未來變化

我們計劃在2016年11月底推出更新地理編碼API,這將增加地理編碼和地點性能之間的區別,以避免含糊不清和明確的查詢。此更改將提高明確查詢的地理編碼結果的質量,但如果地理編碼API無法找到高質量結果,則更有可能返回ZERO_RESULTS,導致模糊或不完整的查詢。

如果您已經使用上述最佳實踐,你應該看到在你的地址解析API的結果的改善。如果您目前正在使用地理編碼API進行不完整或含糊不清的查詢,或者對於可能包含非地址信息(例如商家名稱或公寓號碼)的查詢,我們建議您切換到Places API,因爲它可能會改善您的用例的質量結果。

(重點煤礦)

+0

嗯,例如,在給定的查詢接縫明顯,我雖然...加我沒有得到ZERO_RESULTS。不要少,我可以看看Places API。謝謝。 – leontalbot