【发布时间】:2016-11-21 21:30:09
【问题描述】:
以下 http 请求给出的是曼彻斯特的位置,而不是伦敦的实际皮卡迪利广场地址:
https://maps.googleapis.com/maps/api/geocode/json?address=Piccadilly英国伦敦马戏团
不过,当我在 GoogleMaps 中搜索“英国伦敦皮卡迪利广场”时,我会在地图上找到正确的位置。
以下是从 API 调用获得的结果 JSON:
{
"results": [
{
"address_components": [
{
"long_name": "Piccadilly",
"short_name": "Piccadilly",
"types": [
"establishment",
"point_of_interest"
]
},
{
"long_name": "London Rd",
"short_name": "London Rd",
"types": [
"route"
]
},
{
"long_name": "Manchester",
"short_name": "Manchester",
"types": [
"locality",
"political"
]
},
{
"long_name": "Manchester",
"short_name": "Manchester",
"types": [
"postal_town"
]
},
{
"long_name": "Greater Manchester",
"short_name": "Greater Manchester",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "England",
"short_name": "England",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "",
"short_name": "GB",
"types": [
"country",
"political"
]
},
{
"long_name": "M60",
"short_name": "M60",
"types": [
"postal_code"
]
}
],
"formatted_address": "Piccadilly, London Rd, Manchester M60",
"geometry": {
"location": {
"lat": 53.4771243,
"lng": -2.2310505
},
"location_type": "APPROXIMATE",
"viewport": {
"northeast": {
"lat": 53.4784732802915,
"lng": -2.229701519708498
},
"southwest": {
"lat": 53.4757753197085,
"lng": -2.232399480291502
}
}
},
"partial_match": true,
"place_id": "ChIJ9flXEJaxe0gRpCvy-ySgeBs",
"types": [
"establishment",
"light_rail_station",
"point_of_interest",
"transit_station"
]
}
],
"status": "OK"
}
【问题讨论】:
-
您需要为地点(例如“Piccadilly Circus, London, UK”)使用 places API,地理编码 API 仅适用于 邮政 地址。
标签: json google-maps