【发布时间】:2018-07-19 10:04:47
【问题描述】:
当我按地址搜索结果时,某些查询结果在来自Geocoding API 的 JSON 响应代码中没有locality。这就是我在搜索Houten 时在示例#1 中发生的情况。但是,当我在 example #2 中搜索像 Vianen 这样的城市时,就会有一个地方。这是 API 内部的错误吗?可以解决吗?
示例 #1
{
"results" : [
{
"address_components" : [
{
"long_name" : "Houten",
"short_name" : "Houten",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Utrecht",
"short_name" : "UT",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Nederland",
"short_name" : "NL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Houten, Nederland",
[......],
"types" : [ "administrative_area_level_2", "political" ]
}
],
"status" : "OK"
}
示例 #2
{
"results" : [
{
"address_components" : [
{
"long_name" : "Vianen",
"short_name" : "Vianen",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Vianen",
"short_name" : "Vianen",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Utrecht",
"short_name" : "UT",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Nederland",
"short_name" : "NL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Vianen, Nederland",
[......],
"place_id" : "ChIJJ8URC75jxkcRlnwIUl-xUDY",
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}
【问题讨论】:
标签: api google-maps geocoding google-geocoding-api