以下HTTP請求給出了曼聯的位置,而不是實際的皮卡迪利馬戲團地址在倫敦:谷歌地圖API是給了曼徹斯特地址,而不是皮卡迪利廣場,倫敦,英國
https://maps.googleapis.com/maps/api/geocode/json?address=Piccadilly馬戲團,倫敦,英國
不過,當我在GoogleMaps中搜索「Piccadilly Circus,London,UK」時,我會在地圖中找到正確的位置。
下面是生成的JSON從API調用獲取:
{
"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"
}
您需要爲場所使用places API(如「Piccadill y馬戲團,倫敦,英國「),地理編碼API只能可靠地用於**郵政**地址。 – geocodezip
[google maps api無法找到一個特定地址]的可能重複(http://stackoverflow.com/questions/34727425/google-maps-api-cant-find-one-specific-address) – geocodezip
可能重複的[谷歌地圖標記不固定](http://stackoverflow.com/questions/34781932/google-map-marker-is-not-pinning-properly) – geocodezip