Get Latitude and Longitude values from Google Maps

Contributor Icon Contributed by qmchenry Date Icon June 8, 2007  
Tag Icon Tagged: Google

Google Maps do not display latitude and longitude values, but there is an easy trick to get these numbers. This technique will provide the latitude and longitude coordinates of the center of the map displayed by Google Maps.


Looking up an address in Google Maps will center the map on that address if it was found. Because this trick provides the latitude and longitude of the center of the map, moving the map around manually after that will change the center position and this technique will not work accurately.

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.

Previous recipe | Next recipe |
 
  • Anonymous
    :( Doesn't work for me ... Firefox 2.0 ...
  • costroff
    I have been looking for this forever! Thank you So much for posting this. You have just made my life so much easier!
  • fred
    very nice tip, cheers
  • Gary
    Works nicely. Thanks.
  • Grate dude
  • Kyle
    nice, thank you
  • Mike
    So, I centered the Google map and then copied and pasted some kind of code into my browser. I started with Morse code. Since I had nothing but time, I actually wrote out "dot" and "dash" as I entered the code. I encounted one problem. I do not know Morse code. Anyway, I entered " javascript:void(prompt('',gApplication.getMap().getCenter())); " into my browser. At first there was this slight odor of melting plastic. Then I noticed smoke. So I shut off my computer. Then I thought, Hey Mike, why not go out and by a GPS system. I figured that had to be easier than trying to figure this out, though probably more difficult than advanced Geometry. So that's what I did. And I was right, it was easier.
  • Great tip! Did exactly what I needed! Not easy getting some locations to map into the Google maps plug-in for Wordpress.
  • Amazing and yet so simple, thanks for this tip!

    I'm surprised Google don't just display this in an easy to see location for people.
  • Thanks a lot. Been trying to find the exact location of my house.
  • Cristian Palmas
    Hi.

    I tried to use the code but I failed. Perhaps I misunderstood what is "the location bar of your browser". Can you explain further what "location bar" is?
    Thanks.
  • bRo
    The location bar is the area up at the top of the browser where you can type in the location of a web address. For example, when you visit www.yahoo.com, you will notice an area up at the top that displays "http://www.yahoo.com". That area is the location bar.
  • Thank you very much!!! =]
  • Prasad
    Thank you very much for this. It works and really helpful. I have been looking for this from long time. Earlier, Google maps used to display the GPS position if you drag the location marker off the requested location on the map. I don't know why one fine day Google stopped displaying the GPS position on the map. It only displays the street name now.
  • johan
    sorry to dissapoint you all, but it does not display degrees, minutes and seconds, it displays degrees and decimal fractions of degrees....
  • lanes
    yup, it does work for me.
    thanks man
  • Peter
    "the location bar of your browser"... is the place on your web browser where you type the web address, web link, URL, or URI. It's >not< the place where you put the address that Google Maps finds or has already found for you.

    Thanks for the tip! Very nice.
  • just one word - awesome........and not just cheers... also beers lol
  • Miguel
    Excellent tip, I am using it now, my work is easier.
    Thank you.
  • Ankur
    Awesome man...this trick really worked n helped me a lot.
    Thanx
  • Fei Chen
    It helps, thanks a lot!
  • Joe
    Very nice tool. This came in very handy. Thanks.
  • Tobes
    great, thanks for that. T
  • Lester
    Good jobs! Help me a lots....
  • divayouknow
    worked like a charm- thanks!
  • Sameer
    Thanks
  • Sameer
    Thansk Working for me
  • Doesnt work for me.... so when I got my location in centre it was :

    http://maps.google.com.au/maps?hl=en&tab=wl

    And dis you mean I just add that code at the end of the address or should I do something prior?
  • sfsdf
    doesn't work
  • apps
    Works
  • Frank
    works perfectly.
  • Robert
    Location bar? WTH?
    Can you paste an example for us???
blog comments powered by Disqus