2016-11-15 98 views
2

我的地理編碼器曾經很好地工作,但現在它只返回縣,州和國家。根據文檔(https://developers.google.com/maps/documentation/geocoding/intro),地理編碼器應返回地點(城市)。谷歌地圖地理編碼器不返回地方

正在搜索 「溫內特卡」 ...... 預計業績:

{ 
    "results" : [ 
     { 
     "address_components" : [ 
      { 
       "long_name" : "Winnetka", 
       "short_name" : "Winnetka", 
       "types" : [ "locality", "political" ] 
      }, 
      { 
       "long_name" : "New Trier", 
       "short_name" : "New Trier", 
       "types" : [ "administrative_area_level_3", "political" ] 
      }, 
      { 
       "long_name" : "Cook County", 
       "short_name" : "Cook County", 
       "types" : [ "administrative_area_level_2", "political" ] 
      }, 
      { 
       "long_name" : "Illinois", 
       "short_name" : "IL", 
       "types" : [ "administrative_area_level_1", "political" ] 
      }, 
      { 
       "long_name" : "United States", 
       "short_name" : "US", 
       "types" : [ "country", "political" ] 
      } 
     ], 
     "formatted_address" : "Winnetka, IL, USA", 
     "geometry" : { 
      "bounds" : { 
       "northeast" : { 
        "lat" : 42.1282269, 
        "lng" : -87.7108162 
       }, 
       "southwest" : { 
        "lat" : 42.0886089, 
        "lng" : -87.7708629 
       } 
      }, 
      "location" : { 
       "lat" : 42.10808340000001, 
       "lng" : -87.735895 
      }, 
      "location_type" : "APPROXIMATE", 
      "viewport" : { 
       "northeast" : { 
        "lat" : 42.1282269, 
        "lng" : -87.7108162 
       }, 
       "southwest" : { 
        "lat" : 42.0886089, 
        "lng" : -87.7708629 
       } 
      } 
     }, 
     "place_id" : "ChIJW8Va5TnED4gRY91Ng47qy3Q", 
     "types" : [ "locality", "political" ] 
     } 
    ], 
    "status" : "OK" 
} 

實際結果:

{ 
    "results" : [ 
     { 
     "address_components" : [ 
      { 
       "long_name" : "New Trier Township", 
       "short_name" : "New Trier Township", 
       "types" : [ "administrative_area_level_3", "political" ] 
      }, 
      { 
       "long_name" : "Cook County", 
       "short_name" : "Cook County", 
       "types" : [ "administrative_area_level_2", "political" ] 
      }, 
      { 
       "long_name" : "Illinois", 
       "short_name" : "IL", 
       "types" : [ "administrative_area_level_1", "political" ] 
      }, 
      { 
       "long_name" : "United States", 
       "short_name" : "US", 
       "types" : [ "country", "political" ] 
      } 
     ], 
     "formatted_address" : "New Trier Township, IL, USA", 
     "geometry" : { 
      "bounds" : { 
       "northeast" : { 
        "lat" : 42.1282269, 
        "lng" : -87.71080979999999 
       }, 
       "southwest" : { 
        "lat" : 42.0886089, 
        "lng" : -87.7708629 
       } 
      }, 
      "location" : { 
       "lat" : 42.10808340000001, 
       "lng" : -87.735895 
      }, 
      "location_type" : "APPROXIMATE", 
      "viewport" : { 
       "northeast" : { 
        "lat" : 42.1282269, 
        "lng" : -87.7108162 
       }, 
       "southwest" : { 
        "lat" : 42.0886089, 
        "lng" : -87.7708629 
       } 
      } 
     }, 
     "place_id" : "ChIJW8Va5TnED4gRY91Ng47qy3Q", 
     "types" : [ "locality", "political" ] 
     } 
    ], 
    "status" : "OK" 
} 
+0

在返回的結果中返回「Winnetka」(帶有「types」:[「locality」,「political」])。 – geocodezip

+0

對地址進行地理編碼時,我們實際上遇到與城市未被返回相同的問題。 –

+0

geocodezip,你介意發佈你的請求嗎?我相信你可能會使用不同的版本,但我不確定如何更改版本以及哪個版本仍然返回正確的數據。 –

回答

2

我在同一條船上,你。您正在搜索的級別沒有被返回。如果你搜索一個地方,它就會丟失。如果您搜索administrative_area_level_1,它就會丟失。

@geocodezip在同一問題的另一個問題認爲它是服務器特定的。有時候會發生這種情況,通常在谷歌顯然正在做出改變的時候。儘管如此,希望它很快得到解決,但現在真的讓我很傷心。

+0

如果這是真的,那就像PayPal停止10美元到11美元之間的交易。這是一個愚蠢的怪癖,讓我想到切換到MapBox。 –

+0

是的,這是非常不方便的,因爲我的應用程序完全被破壞了。對此我們無能爲力。我相信這是事實,因爲它昨晚爲一些人而不是其他人工作。我開始聽到有關MapBox的事情。你對此有何看法? –

+0

它現在對你有用嗎?我恢復了業務。至少暫時。 –