Google maps API geocoding returns same coordinates for two different places

前端 未结 2 1101
清酒与你
清酒与你 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.

    0 讨论(0)
  • 2021-01-03 18:16

    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.

    0 讨论(0)
提交回复
热议问题