Google maps API geocoding returns same coordinates for two different places

非 Y 不嫁゛ 提交于 2019-11-30 16:35:37

Those are "places" not postal addresses. They both resolve to the same "address" as far as the geocoder is concerned ("Corfu, Greece"). If you need to include the "place name" (you don't have a complete postal address), use the Places API

Some major points of interest are included in the geocoding database (like "Eiffel Tower", "Statue of Liberty", "Cologne Cathedral") but not all.

They are both resolving to the same ADDRESS - since only a name is given instead of a street address. Try this:

https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=Paleo+Enetiko+Frourio,+Corfu+491+00+Greece&key=YOUR_API_KEY

That returns:

"description": "Paleo Enetiko Frourio, Corfu, 491 00, Greece",
"place_id": "ChIJc8Bxy-ddWxMRhASx_pNTDTU",

And then calling with the place_id:

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJc8Bxy-ddWxMRhASx_pNTDTU&key=YOUR_KEY_HERE

That'll do the trick.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!