Get address from latitude and longitude

Getting Address for latitude and longitude are to easy with Google Map Javascript API.


following are few line javascript code that return Address for Latitude 21.211259 Longitude 72.850255

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var geocoder = new google.maps.Geocoder();
var lat = 21.211259534310496;
var long = 72.85025596618652;
var latLng = new google.maps.LatLng(lat, long);
geocoder.geocode({       latLng: latLng     }, function(responses) {     if (responses && responses.length > 0) {        alert(responses[0].formatted_address);     } else {       alert('Cannot determine address at this location.');     }   });
</script>

Post a Comment

2 Comments

  1. Thanks a lot my friend.....
    It works... :-)

    ReplyDelete
  2. Please , i'm new with javascript , i want to implement this code in an HTML file?
    How can i do that?

    ReplyDelete
Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)