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

后端 未结 5 1208
清歌不尽
清歌不尽 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:16

    Flyleaf, I work at SmartyStreets where we also provide an API to get the coordinates of addresses; it's called LiveAddress API.

    As Bart mentioned, Google's TOS won't allow you to geocode without showing a Google Map, and what's more is you can't store the results. If you're looking to locate an address as you've suggested, I recommend something like LiveAddress which will actually verify the validity of the address as well -- these other APIs and HTML5 will not do that.

    Hope you find something that works for you. The question right now is a little vague, but maybe this will help. It might go something like this (with Javascript):

    LiveAddress.geocode(address, function(geo) {
        alert("The address is at: " + geo.coords);
    });
    

提交回复
热议问题