How to get address location from latitude and longitude in Google Map.?

JavascriptPhpGoogle Maps

Javascript 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.

Click here to get an API key

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBoris KuzevanovView Question on Stackoverflow
Solution 1 - Javascriptuser2092317View Answer on Stackoverflow
Solution 2 - JavascriptSajuna FernandoView Answer on Stackoverflow
Solution 3 - JavascriptDinesh PrajapatiView Answer on Stackoverflow