Google Maps Reverse Geocoder

This reverse geo-coder will convert a point on a map to an address. In practice this means the nearest available address.



  • Click anywhere on the map of Belfast
  • You should then get a popup window telling you the address of the location you have just clicked.

Javascript Used

var geocoder;
var map;

function initialize()
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(54.55, -5.953);
var myOptions = {zoom: 11,center: latlng,mapTypeId:google.maps.MapTypeId.HYBRID,draggableCursor:'crosshair'}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
google.maps.event.addListener(map, 'click',function(me){
function codeLatLng(latlng)
if (geocoder)
geocoder.geocode({'latLng': latlng}, function(results, status)
if (status == google.maps.GeocoderStatus.OK)
if (results[1])
document.getElementById("message").innerHTML="Geocoder failed due to: " + status;

Comments For This Page

Hi, If you want the country instead of the full address use "place = response.Placemark[0]" then "place.address" and this should return the country name. This is what is being used on Click For Country.
By Daft Logic on 3rd May 2008
nice job there!

I'm wondering how difficult this will be to simply output the country...

When you zoom out of this version and click, it bugs out displaying several addresses
By Bitcloud on 23rd April 2008

Add your own comment below and let others know what you think:

Share This Page

Share this page with others using one of the methods below. Telling others about Daft Logic is good and we appreciate your support!