Monday, June 11, 2007

Lat/Long Bookmarklet for Google Maps

Not your typical distance education-related posting, except you might want to know where your students are - yeah, that's the connection! ;-)

Last week my family started geocaching - great fun and I highly recommend it if you don't live deep in a big city. Even then it can be done, but it's different. Anyhoo, I happened to come across a post at Tech Recipes that shows a little snip of javascript that you can use while viewing Google Maps to obtain the latitude and longitude of that particular location. They suggested,

When the location you want is in the center of the map, copy and paste this code into the location bar of your browser and press enter:

javascript:void(prompt('',gApplication.getMap().getCenter()));

A little dialog box will pop up displaying the coordinates which can be copied and pasted for use elsewhere. This code can be bookmarked and then used in the future by selecting the bookmark.

But you know there's no dang way anyone's going to remember that, so why not make it a bookmarklet? After I whipped one up, then I checked to see if it had already been done, and found this version, but it doesn't allow you to easily copy the coordinates to another application, so I think mine's better. :-)

Drag this to your bookmarks toolbar in Firefox, then find a location in Google Maps, hit the bookmarklet, and voila! There's your latitude and longitude ready for copying into any application.