How do I get an addresses latitude-longitude using HTML5 geolocation or Google API?

后端 未结 5 1207
清歌不尽
清歌不尽 2021-02-04 18:52

I am getting baffled with a problem that is, I can get the location of a user from Facebook and all I need is to get the latitude and longitude of that location, but I still cou

5条回答
  •  不知归路
    2021-02-04 19:14

    I found the best option to be to use OpenStreetMap directly via a sub-project (Nominatim) API they have.

    API documentation

    Example REST call: http://nominatim.openstreetmap.org/reverse?format=xml&lat=35.958&lon=-83.952&zoom=18

    Note that while their terms of service does allow direct client-side use from browser JavaScript, they don't want high-volume use and suggest using your server as a proxy to add caching and so it can be easily switched. The data is available for download, and instructions are provided for setting up a locally query-able database of the data.

提交回复
热议问题