我的地理編碼器曾經很好地工作,但現在它只返回縣,州和國家。根據文檔(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"
}
在返回的結果中返回「Winnetka」(帶有「types」:[「locality」,「political」])。 – geocodezip
對地址進行地理編碼時,我們實際上遇到與城市未被返回相同的問題。 –
geocodezip,你介意發佈你的請求嗎?我相信你可能會使用不同的版本,但我不確定如何更改版本以及哪個版本仍然返回正確的數據。 –