88

Is there some url I can construct with a latitude,longitude pair that will lead me directly to a google maps page to visualize that location?

For example, the following pseudocode:

var lat = 43.23;
var lng = 114.08;

var url = 'http://google.com/maps/bylatlng?lat=' + lat + '&lng=' + lng';

print 'click here to see this location in google maps!: <a href="' + url + '">go</a>';

Something like that?

Thanks

user291701
  • 38,411
  • 72
  • 187
  • 285

2 Answers2

217

You should be able to do something like this:

http://maps.google.com/maps?q=24.197611,120.780512

Some more info on the query parameters available at this location

Here's another link to an SO thread

Community
  • 1
  • 1
dawebber
  • 3,503
  • 1
  • 16
  • 16
  • 9
    You can control the zoom by adding &z= to the end of that url (e.g. http://maps.google.com/maps?q=24.197611,120.780512&z=18). – Jonathan McIntire Apr 27 '11 at 16:13
  • 1
    Try this: http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters – Edward Falk Apr 18 '13 at 15:59
  • 3
    @JonathanMcIntire the ability to set the zoom level like that doesn't seem to work any more; for your link it always seems to default it to zoom level 17 now. Any ideas on how to control this? – duncan Nov 26 '15 at 10:36
24

From my notes:

http://maps.google.com/maps?q=37.4185N+122.08774W+(label)&ll=37.419731,-122.088715&spn=0.004250,0.011579&t=h&iwloc=A&hl=en

Which parses like this:

    q=latN+lonW+(label)     location of teardrop

    t=k             keyhole (satelite map)
    t=h             hybrid

    ll=lat,-lon     center of map
    spn=w.w,h.h     span of map, degrees

iwloc has something to do with the info window. hl is obviously language.

See also: http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
  • 2
    A bit off-topic but maybe still helpful for those who would like to specify a label/title/name for the marker on the Google Maps iOS app: while `q=lat,long+(My%20custom%20location%20name)` does no longer seem to work for the Google Maps web site, it does currently (still) work on their iOS app. – Daniel Pietzsch Feb 16 '18 at 19:23