reveal search box

bookmarklet to find latitude longitude in google maps 19/04/2007

i searched high and low for a simple google maps bookmarklet which would easily output the latitude and longitude of the center of the map. i couldn't find anything that works on the recent version of google maps. so i spent some time inspecting the javascript and here it is:

javascript:alert(window.gApplication.getMap().getCenter())
bookmarklet: get center from google maps.

it actually looks suprisingly easy when i finally inspected all the objects in the global scope (window), but it took me ages to figure out how to use the firefox javascript debugger, and then spent ages hitting brick walls be searching through the code for references to where it kept the GMaps2 object. but in fact, it was there all along in the index.html file as gApplication.

  • 3 comments
  • google hack javascript maps
  • 2 years, 2 months ago (19/04/2007)
add commentAdd a comment
Alastair Tse says
3
I like yours better too. But on Safari, I can select the text in dialog boxes too. So I guess for non-Safari users, yours is definitely better!

Thanks for sharing it.
  • 2 years ago (11/06/2007)
Paul says
2
Did this before searching to see what else had been done already - <a href="http://distlib.blogs.com/distlib/2007/06/latlong_bookmar.html">this version</a> allows easier copy/paste of the pop-up coords...
  • 2 years ago (11/06/2007)
Ray says
1
Brilliant! Love it. Thanks 8 )
  • 2 years, 1 month ago (24/05/2007)