Get Latitude and Longitude values from Google Maps
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.




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!
fred said on October 3, 2008
very nice tip, cheers
Gary said on October 4, 2008
Works nicely. Thanks.
test said on October 15, 2008
Grate dude
Kyle said on October 28, 2008
nice, thank you
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.
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.
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.
Adam said on December 14, 2008
Thanks a lot. Been trying to find the exact location of my house.
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.
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.
FreakEROS said on December 18, 2008
Thank you very much!!! =]
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.
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….
lanes said on February 19, 2009
yup, it does work for me.
thanks man
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
waqas said on February 28, 2009
just one word – awesome……..and not just cheers… also beers lol
Miguel said on March 4, 2009
Excellent tip, I am using it now, my work is easier.
Thank you.
Ankur said on April 16, 2009
Awesome man…this trick really worked n helped me a lot.
Thanx
Fei Chen said on April 18, 2009
It helps, thanks a lot!
Joe said on April 19, 2009
Very nice tool. This came in very handy. Thanks.
Tobes said on April 20, 2009
great, thanks for that. T
Lester said on May 19, 2009
Good jobs! Help me a lots….
divayouknow said on May 19, 2009
worked like a charm- thanks!
Sameer said on May 22, 2009
Thansk Working for me
Sameer said on May 22, 2009
Thanks
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?
sfsdf said on June 17, 2009
doesn’t work
apps said on June 19, 2009
Works
Frank said on June 24, 2009
works perfectly.
Robert said on June 24, 2009
Location bar? WTH?
Can you paste an example for us???
Anonymous said on August 1, 2009
But why doesnt it work with windows vista? is there a different version for that?
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.
Paul said on August 13, 2009
Great very useful for plotting routes with a GPS
Anonymous said on August 15, 2009
cool…thx a lot
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!!!
Anonymous said on August 18, 2009
Thanks foe the informatiom
Anonymous said on September 12, 2009
Thanks for this hint it was very useful.
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.
SpyBlogger said on November 1, 2009
Wow I needed it a lot!
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.
Shripad Lale said on December 3, 2009
Amazing! Very simple and works great! Thanks for the great tip.
regards,
Shripad
======
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.
Sergio said on December 30, 2009
Works fine for Internet Explorer 8. Thank you, thank you, thank you!
Anonymous said on January 4, 2010
Thanks, works for me :-)
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.
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…
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.
Anonymous said on March 19, 2010
How do I turn longitude and latitude off with google maps?
Thanks for your assistance
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.
Anonymous said on May 17, 2010
awesome tip, thanks.
J
Best Desi said on June 19, 2010
Thanks for this!
Steve said on June 21, 2010
thanks, nice trick!
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)
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
Sherif Halim said on September 4, 2010
very smart! thanks
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…
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.
warley996 said on September 17, 2010
thnks man!,
José Andrés Martínez said on October 5, 2010
Works perfect| beautiful trick / thanks for sharing it
butik online baju import said on October 8, 2010
Wow, I tried it and it really work for me.. Thx a lots ;)
Paul Abarge said on October 9, 2010
does not work. forget it.
David Kirk - Founder/Editor said on October 9, 2010
I just tested it. Still working.
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.
Raj R said on November 12, 2010
Works great thanks!
Mira said on November 25, 2010
Works for me. Thanks!
LarryRules2010 said on December 25, 2010
TYVM
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??
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. :-)
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.
BillybobWilliamRoberts said on February 8, 2011
Do you think he cares….2 years later?
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.
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/
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!!!
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