How to get address location from latitude and longitude in Google Map.?
JavascriptPhpGoogle MapsJavascript Problem Overview
So I have latitude and longitude Like 44.4647452
and 7.3553838
. I need to get address like: Milan, Italy, str. Kennedy 89.
How I can do it?
Javascript Solutions
Solution 1 - Javascript
Simply pass latitude, longitude and your Google API Key to the following query string, you will get a json array, fetch your city from there.
https://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452,7.3553838&key=YOUR_API_KEY
Note: Ensure that no space exists between the latitude and longitude values when passed in the latlng parameter.
Solution 2 - Javascript
What your looking for is Reverse Geo Coding. Have a look at this example here. https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse
Solution 3 - Javascript
You have to make one ajax call to get the required result, in this case you can use Google API to get the same
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true/false
Build this kind of url and replace the lat long with the one you want to. do the call and response will be in JSON, parse the JSON and you will get the complete address up to street level