最近我的代码收到的结果包含一个地理编码结果,但结果和建筑物的address_component都有一个空的“types”数组。
阅读完文档后,我原本期望“types []”填充“前提”或其他类似内容。 来自文档:
The types[] array indicates the type of the returned result. This array contains a set of one or more tags identifying the type of feature returned in the result.
此输入间接来自外部来源,因此在这种情况下,我不能简单地省略建筑物名称或以其他方式修改我的请求。
这是API wrt建筑物/场所的错误吗?或者这有点没有记载,但仍然有效/预期?
地理编码的地址是:“Barclay Tower 10 Barclay Street,New York”
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Barclay+Tower+10+Barclay+Street%2C+New+York
答案是:
{"status": "OK",
"results": [{..
"address_components": [
"address_components": [{
"long_name": "Barclay Tower",
"short_name": "Barclay Tower",
"types": []
},
...
"formatted_address": "Barclay Tower, 10 Barclay Street, New York, NY 10007, USA",
"types": []
}]
}