get Lat Lang from a place_id returned by autocomplete place api

前端 未结 12 1457
情深已故
情深已故 2021-02-02 05:58

I am searching the place in my apps using the google autocomplete place api and now I want to get latitude and longitude of the place that i have searched. How to get latitude a

12条回答
  •  执念已碎
    2021-02-02 06:06

    Geocoding is a very indirect solution, and like the second responder said, if you do "Apple Store" it may not return the full address. Instead:

    Place_ID contains everything you need. I am assuming you know how to get the place_id from the Places API (they have a full example if not).

    Then pull a second request for the place details (including latitude and longitude under the geometry section) using the place_id following this documentation: https://developers.google.com/places/documentation/details?utm_source=welovemapsdevelopers&utm_campaign=mdr-devdocs

提交回复
热议问题