Google maps API geocoding returns same coordinates for two different places

前端 未结 2 1103
清酒与你
清酒与你 2021-01-03 17:35

I\'m trying to get the coords for these POI but Google Geocoding returns wrong coords, the same coords for both addresses. In the Google Maps they work fine. How should I co

2条回答
  •  再見小時候
    2021-01-03 18:04

    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.

提交回复
热议问题