HOWTO: use latitude and longitude with Google Maps

gmaplatlon_20070802.jpg

Whether you want to quickly add a waypoint to your GPS, or view a map of a known location, it can often be convenient to use real latitude and longitude values with Google Maps instead of dealing with street addresses.

Rerieving a map for a lat/lon value is simple enough with Google Maps. You can simply enter the decimal latitude and longitude into the search form instead of a street address.

However, if you're viewing a map and you want to retrieve the lat/lon location, there unfortunately isn't a convenient "get latitude and longitude" button. Google Maps deals with latitude and longitude locations internally, though, so with this little snippet of javascript, you can easily get the job done:

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

This will return the coordinates of the map's center point. You might want to double-click a position on the map before running the above code. Doing so will reposition that point to the center of the map automatically.

Get Latitude and Longitude values from Google Maps - [via] Link

Posted by Jason Striegel | Aug 2, 2007 07:50 PM
Google Maps, Mapping | Permalink | Comments (7) Bookmark and Share

Recent Entries

Comments

Newest comments listed first.

Posted by: ltt on August 2, 2007 at 10:55 PM

Great tip, but why the I-35W bridge?


Posted by: ltt on August 2, 2007 at 10:56 PM

Great tip, but why the I-35W bridge?


Posted by: neilbert on August 3, 2007 at 4:54 AM

@ltt: You're kidding, right?

http://www.cnn.com


Posted by: MacGyverS2000 on August 3, 2007 at 6:16 AM

An easier method that doesn't require javascript (though may be [u]slightly[/u] less accurate) is to simply right-click on the area of the map you're interested in and click the "Directions to here" option. If you don't have a starting point already on the map, it will fill in the endpoint above with the location followed by the lat/lon (i.e., Anywhere,TX@xx.xxxxxx, yy.yyyyyy).


Posted by: jason_striegel on August 3, 2007 at 9:48 AM

Thanks ltt. Regarding the 35W Mississippi bridge -- I live in Minneapolis and was seeing if Google's map had been updated. It seemed like an appropriate and topical location which doesn't have a street address, but that a person might want to locate.

For those who didn't hear about this, the bridge completely collapsed during a bumper-to-bumper traffic jam Wednesday and, thankfully, the vast majority of drivers managed to walk away after plummeting 70 feet into the river.

Here's a good photo gallery if you're insterested - Link


Posted by: ltt on August 4, 2007 at 9:47 PM

@ neilbert: I was fully aware of the bridge collapse when I posted my previous comment. It was no joke. Thats why I asked. I live near the Twin Cities, and lived in Minneapolis for a short time years ago. The tragedy is close to my heart as well. I was simply wondering why there was no other explanation as to why that location was chosen.

@ jason_striegel: Thanks for clearing it up though.


Posted by: cyenobite on August 6, 2007 at 12:56 PM

...also just click on the "link to this page" the Lat and Long show up in the link... in several different formats.


Leave a comment



Bloggers

Welcome to the Hacks Blog!

Brian Jepson.Brian Jepson


Jason Striegel.Jason Striegel


Philip Torrone.Phillip Torrone



See all of the books in the Hacks Series!
Advertise here.

Recent Posts

www.flickr.com
photos in Hacks More photos in Hacks

Most read entries (last 30 days)