Get Latitude and Longitude values from Google Maps

Contributor Icon Contributed by qmchenry  
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.

If you don’t like using javascript, you can use the easy way to find latitude and longitude.

 

75 Comments -


  1. Anonymous said on October 2, 2008

    I have been looking for this forever! Thank you So much for posting this. You have just made my life so much easier!

  2. fred said on October 3, 2008

    very nice tip, cheers

  3. Gary said on October 4, 2008

    Works nicely. Thanks.

  4. test said on October 15, 2008

    Grate dude

  5. Kyle said on October 28, 2008

    nice, thank you

  6. Mike said on November 12, 2008

    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.

  7. Debbie said on November 16, 2008

    Great tip! Did exactly what I needed! Not easy getting some locations to map into the Google maps plug-in for Wordpress.

  8. Timothy Bowers said on December 8, 2008

    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.

  9. Adam said on December 14, 2008

    Thanks a lot. Been trying to find the exact location of my house.

  10. Cristian Palmas said on December 15, 2008

    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.

  11. bRo said on December 15, 2008

    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 http://www.yahoo.com, you will notice an area up at the top that displays “http://www.yahoo.com”. That area is the location bar.

  12. FreakEROS said on December 18, 2008

    Thank you very much!!! =]

  13. Prasad said on December 26, 2008

    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.

  14. johan said on January 19, 2009

    sorry to dissapoint you all, but it does not display degrees, minutes and seconds, it displays degrees and decimal fractions of degrees….

  15. lanes said on February 19, 2009

    yup, it does work for me.
    thanks man

  16. Peter said on February 24, 2009

    “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

  17. waqas said on February 28, 2009

    just one word – awesome……..and not just cheers… also beers lol

  18. Miguel said on March 4, 2009

    Excellent tip, I am using it now, my work is easier.
    Thank you.

  19. Ankur said on April 16, 2009

    Awesome man…this trick really worked n helped me a lot.
    Thanx

  20. Fei Chen said on April 18, 2009

    It helps, thanks a lot!

  21. Joe said on April 19, 2009

    Very nice tool. This came in very handy. Thanks.

  22. Tobes said on April 20, 2009

    great, thanks for that. T

  23. Lester said on May 19, 2009

    Good jobs! Help me a lots….

  24. divayouknow said on May 19, 2009

    worked like a charm- thanks!

  25. Sameer said on May 22, 2009

    Thansk Working for me

  26. Sameer said on May 22, 2009

    Thanks

  27. Irawan said on June 16, 2009

    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?

  28. sfsdf said on June 17, 2009

    doesn’t work

  29. apps said on June 19, 2009

    Works

  30. Frank said on June 24, 2009

    works perfectly.

  31. Robert said on June 24, 2009

    Location bar? WTH?
    Can you paste an example for us???

  32. Anonymous said on August 1, 2009

    But why doesnt it work with windows vista? is there a different version for that?

  33. tucsonjhall said on August 5, 2009

    This all works very nicely but you can also search an address in Google then right click on the pin and choose What’s Here? and it will display the lat and long in the query input field. Nice because you can cut and paste that into another app.

  34. Paul said on August 13, 2009

    Great very useful for plotting routes with a GPS

  35. Anonymous said on August 15, 2009

    cool…thx a lot

  36. nick said on August 17, 2009

    you rule!!!!!!!!!!!!!!!!!!!!!!!

    works “just fine”(perfect to be exact ; ) !!!

    i wonder why is it so freakin’ hard for google to provide this info anyway…could it be $ issues ; ( ?

    a big thanks!!!

  37. Anonymous said on August 18, 2009

    Thanks foe the informatiom

  38. Anonymous said on September 12, 2009

    Thanks for this hint it was very useful.

  39. Joseph Elfelt said on October 21, 2009

    Actually right-click on the pin does not get you the center of the map except by mere chance. Instead, it gives you the coords where you right-clicked. You can confirm this by clicking different parts of the pin and comparing the results to the javascript method that is the subject of this thread.

  40. SpyBlogger said on November 1, 2009

    Wow I needed it a lot!

  41. Anonymous said on December 2, 2009

    Great, thanks! Anyone know how to get it to display UTM rather than lat/long?

    For those struggling to make this tip/recipe work, try this: copy the javascript snippet. Open bookmarks -> organize bookmarks (in firefox – not sure how to do it in other browsers). Click ‘organize’ -> ‘new bookmark’. In ‘name’ type whatever you want. In ‘location’ paste the javascript. Click ‘ok’. Close the bookmark organizer. Go back to google maps, centre the map wherever you want, then go to your bookmark menu and select the bookmark you just created. A popup window will appear with the latitude and longitude of the centre of the map.

  42. Shripad Lale said on December 3, 2009

    Amazing! Very simple and works great! Thanks for the great tip.

    regards,

    Shripad
    ======

  43. Ajay said on December 15, 2009

    wow kool, I didn’t know it was so easy to find long and lat. I used to read them from the embed code.

  44. Sergio said on December 30, 2009

    Works fine for Internet Explorer 8. Thank you, thank you, thank you!

  45. Anonymous said on January 4, 2010

    Thanks, works for me :-)

  46. Michael McGinnis said on February 16, 2010

    Yes, tucsonjhall’s idea is easier now. Right-click on the spot, choose “What’s Here?” and you’ll be given the coordinates, as well as what name Google associates with the place. For example, clicking on my university building gives the name of surrounding streets, depending on what part of the building you click, since the building isn’t in their database.

  47. Dominique Guinard said on February 24, 2010

    Thanks bunch! Worked fine for me as well. Wondering why google does not provide that as a feature…

  48. anand said on February 25, 2010

    The only problem is this may not be accurate.

    Try to resize the window and run this script again. See that the values are different. The values seem to be dependent on the size of the browser window, which is bizarre.

  49. Anonymous said on March 19, 2010

    How do I turn longitude and latitude off with google maps?

    Thanks for your assistance

  50. jones1618 said on April 6, 2010

    This is really handy. Suggested improvement: Turn the above code into a link so readers can drag-and-drop it as a bookmarklet into their toolbars.

  51. Anonymous said on May 17, 2010

    awesome tip, thanks.

    J

  52. Best Desi said on June 19, 2010

    Thanks for this!

  53. Steve said on June 21, 2010

    thanks, nice trick!

  54. Kevin Morrison said on June 22, 2010

    The whole units of degrees will remain the same (i.e. in 121.135° longitude, start with 121°).

    Multiply the decimal by 60 (i.e. .135 * 60 = 8.1).

    The whole number becomes the minutes (8′).

    Take the remaining decimal and multiply by 60. (i.e. .1 * 60 = 6).

    The resulting number becomes the seconds (6″). Seconds can remain as a decimal.

    Take your three sets of numbers and put them together, using the symbols for degrees (°), minutes (‘), and seconds (“) (i.e. 121°8′6″ longitude)

  55. flo_sb said on August 23, 2010

    just go to desired location , right click it and then select “what’s here?”
    mouseover and read coords

  56. Sherif Halim said on September 4, 2010

    very smart! thanks

  57. Pjwannys said on September 11, 2010

    It works…but only if you FIRST pull down the google bar “pop-up blocker” tab and select “always allow popups from Google Mpas.” Very useful, but ultimately, for my purposes (sending to my android navigation via email to myself) it is better to click the “link” tab and cut & paste this into the email.

    Then, when out in the field, no need to search for a spot – merely open the gmail with the link embeded and click on it and – off you go…

  58. Pjwannys said on September 11, 2010

    That should read Google Maps” rather than “Mpas” anyway, thanks for this nifty tip. Very useful when helping my 6th grader do geography reports, etc.

  59. warley996 said on September 17, 2010

    thnks man!,

  60. José Andrés Martínez said on October 5, 2010

    Works perfect| beautiful trick / thanks for sharing it

  61. butik online baju import said on October 8, 2010

    Wow, I tried it and it really work for me.. Thx a lots ;)

  62. Paul Abarge said on October 9, 2010

    does not work. forget it.

  63. David Kirk - Founder/Editor said on October 9, 2010

    I just tested it. Still working.

  64. Cailean Babcock said on October 18, 2010

    Not very precise (ironically), if you try to do the math to convert this to minutes and seconds. I wound up wildly off from the original location. Use with caution.

  65. Raj R said on November 12, 2010

    Works great thanks!

  66. Mira said on November 25, 2010

    Works for me. Thanks!

  67. LarryRules2010 said on December 25, 2010

    TYVM

  68. Nizam Sp said on January 18, 2011

    Great one.. If I want to automate it. (For example, given a search word, I need lat long). Any Idea guys??

  69. Vancler2000 said on January 19, 2011

    If you think that going out, spending time and money, and getting a GPS is easier than typing a line of code into your web browser address, than… actually I’m at a loss for words on this one. Works perfectly and it’s more accurate, cheap and faster than buying a GPS. :-)

  70. Ivan said on January 31, 2011

    Wow, I did not expect this to work. I had no idea you could pass javascript through the address/location field that way and have it “interact” with the website. I plan on using this to add geotagging to some content on my personal site.

  71. BillybobWilliamRoberts said on February 8, 2011

    Do you think he cares….2 years later?

  72. Researcher said on March 13, 2011

    Thanks! Is it possible for a bash or python script to query Google maps and get the returned values? That would be very helpful for our work, and save a lot of time.

  73. Researcher said on March 13, 2011

    Thanks again for pointing out this feature.
    Found the Google maps api page!

    http://code.google.com/apis/maps/

  74. Chathura Asanga said on December 26, 2011

    You can do this very easier than this.

    1) Right click on the required point of the google map
    2) select “What’s here?” from the pop up menu.
    3) Focus the mouse pointer to that point again

    You can see both Latitude and Longitude as a tooltip!!!

    Also you can see the coordinates on the title bar of the browser!!!

  75. Shahroon said on January 25, 2012

    i have used the map in my website,now i want it to be pointed on my city when the page loads for the first time..the map is centred on australia’s some location as done in the tutorial given at google’s developer section.Is latlng the function,by changing the values i can get to my own city whenever i open it…do i need to specify that in the code? tell me any easy way..thanks

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -