176

I would like to produce a url for Google Maps that goes to a specific latitude and longitude. Now, I generate a url such as this:

http://maps.google.com/maps?z=11&t=k&q=58 41.881N 152 31.324W

The resulting map comes up with a round "A" balloon pointer, which seems to point to the nearest named object, and a green arrow, which points to the lat-lon. Sometimes, as in this example, the "A" pointer is centered and is far enough away that you cannot see the pointer to the lat-lon. (Zoom out to see both pointers in this example. The "A" pointer is in the center of Alaska, while the lat-long pointer is on Kodiak Island.)

Are there some parameters I can use in the Google Maps URL that will produce a single pointer to a designated lat-lon? (This loads in a separate window. It is not embedded.)

xomena
  • 31,125
  • 6
  • 88
  • 117
xpda
  • 15,585
  • 8
  • 51
  • 82

15 Answers15

263

This is current accepted way to link to a specific lat lon (rather than search for the nearest object).

http://maps.google.com/maps?z=12&t=m&q=loc:38.9419+-78.3020
  • z is the zoom level (1-20)
  • t is the map type ("m" map, "k" satellite, "h" hybrid, "p" terrain, "e" GoogleEarth)
  • q is the search query, if it is prefixed by loc: then google assumes it is a lat lon separated by a +
xordon
  • 5,523
  • 4
  • 18
  • 26
  • Thank you! 'loc:' was the key for me, as just a lat long puts a green pin at the lat/long and then a red pin at the nearest search result. – vfilby Jul 11 '12 at 15:44
  • 4
    FYI, a recent change to google maps means that the `loc` parameter no-longer seems to work as it did. You need to add an `@` symbol - see here: http://stackoverflow.com/questions/22939725/why-has-google-maps-q-parameter-stopped-working – Jon Cage Apr 09 '14 at 07:42
  • `t=k` the way to go for Satellite / current Earth! – Tom Roggero Mar 02 '15 at 06:08
  • 1
    How to make your url zoom parameter work: http://stackoverflow.com/questions/32806084/google-map-zoom-parameter-in-url-not-working/32807681#32807681 – EugenSunic Dec 10 '16 at 23:26
  • Is it possible to add more than one marker to an app? And if it works, how does the structure looks like? – michael-mammut May 12 '17 at 14:39
  • Is there any way to include options like "Avoid Highways" or Tolls etc using the URL. I know how to do that using the Intent but I want to use that in the URL. – CopsOnRoad Feb 10 '18 at 19:34
102

yeah I had the same question for a long time and I found the perfect one. here are some parameters from it.

https://maps.google.com?parameter = value



q=

is used to specify the search query in Google maps search.
eg :

https://maps.google.com?q=newyork or
https://maps.google.com?q=51.03841,-114.01679

near=

is used to specify the location alternative to q=. Also has the added effect of allowing you to increase the AddressDetails Accuracy value by being more precise. Mostly only useful if query is a business or suchlike.

z=

Zoom level. Can be set 19 normally, but in certain cases can go up to 23.

ll=

Latitude and longitude of the map centre point. Must be in that order. Requires decimal format. Interestingly, you can use this without q, in which case it doesn’t show a marker.

sll=

Similar to ll, only this sets the lat/long of the centre point for a business search. Requires the same input criteria as ll.

t=

Sets the kind of map shown. Can be set to:

m – normal  map,
k – satellite,
h – hybrid,
p – terrain

saddr=

Sets the starting point for directions searches. You can also add text into this in brackets to bold it in the directions sidebar.

daddr=

Sets the end point for directions searches, and again will bold any text added in brackets.You can also add "+to:" which will set via points. These can be added multiple times.

via=

Allows you to insert via points in directions. Must be in CSV format. For example, via=1,5 addresses 1 and 5 will be via points without entries in the sidebar. The start point (which is set as 0), and 2, 3 and 4 will all show full addresses.

doflg=

Changes the units used to measure distance (will default to the standard unit in country of origin). Change to ptk for metric or ptm for imperial.

msa=

Does stuff with My Maps. Set to 0 show defined My Maps, b to turn the My Maps sidebar on, 1 to show the My Maps tab on its own, or 2 to go to the new My Map creator form.

dirflg=

can set miscellaneous values below:

h - Avoid highway
t - Avoid tolls

reference http://moz.com/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters

Sameera R.
  • 4,384
  • 2
  • 36
  • 53
  • @SameeraR. Is there any way to include "Avoid Highways, Tolls" etc option using these URLs? – CopsOnRoad Feb 10 '18 at 19:33
  • there is a parameter called dirflg. dirflg=h (Avoid highways), dirflg=t (Avoid tolls). I'll include this in the answer too. – Sameera R. Feb 15 '18 at 05:20
  • [**Docs**](https://developers.google.com/maps/documentation/urls/ios-urlscheme) says that `@` in `https://maps.google.com?q=@51.03841,-114.01679` - should work. but it doesn't. Any idea why ? – Royi Namir May 09 '18 at 11:27
  • did you try adding '/' before '?' like this https://maps.google.com/?q=@37.3161,-122.1836 – Sameera R. May 15 '18 at 04:30
81

In May 2017 Google announced the Google Maps URLs API that allows to construct universal cross-platform links. Now you can open Google maps on web, Android or iOS using the same URL string in form:

https://www.google.com/maps/search/?api=1&parameters

There are several modes that you can use: search, directions, show map and show street view.

So you can use something like

https://www.google.com/maps/search/?api=1&query=58.698017,-152.522067

to open map and place marker on some lat and lng.

For further details please refer to:

https://developers.google.com/maps/documentation/urls/guide

With zoom (z: 1 to 20) you can use this:

https://maps.google.com/?q=38.6531004,-90.243462&ll=38.6531004,-90.243462&z=3

geocodezip
  • 158,664
  • 13
  • 220
  • 245
xomena
  • 31,125
  • 6
  • 88
  • 117
38

This should help with the new Google Maps:

https://maps.google.com/maps/place/<name>/@<lat>,<long>,15z/data=<mode-value>
  • The place adds a marker.
  • name could be a search term like "realtors"/"lawyers".
  • lat and long are the coordinates in decimal format and in that order.
  • 15z sets zoom level to 15 (must be between 1 ~ 20).
  • You can enforce a particular view mode (map is default) - earth or terrain by adding these:
    • Terrain: /data=!5m1!1e4
    • Earth: /data=!3m1!1e3

E.g.: https://www.google.com/maps/place/Lawyer/@48.8187768,2.3792362,15z/data=!3m1!1e3

References:
https://moz.com/blog/new-google-maps-url-parameters http://dddavemaps.blogspot.in/2015/07/google-maps-url-tricks.html

Valerio Bozz
  • 1,176
  • 16
  • 32
Jithin Nair
  • 841
  • 9
  • 7
12

The following works as of April 2014. Delimiting each component of the URL with + and & for spaces and addition statements, respectively.

Full HTML:

<iframe src="http://maps.google.com/maps?q=Scottish+Rite+Hamilton+ON&loc:43.25911+-79.879494&z=15&output=embed"></iframe>

Broken down:

http://maps.google.com/maps?q=

where ?q= starts the general search, which I provide a venue, city, province info using + for spaces.

Scottish+Rite+Hamilton+ON

Next the geo-data. Lat and lng.

&loc:43.25911+-79.879494

Zoom level

&z=15

Required for iframes:

&output=embed
DeBraid
  • 8,751
  • 5
  • 32
  • 43
  • 1
    Thank you very much for providing this information. This is exactly what I was looking for! – Joe Morales Sep 04 '14 at 16:03
  • 1
    The zoom level parameter doesn't seem to make any difference, has this param changed? E.G compare http://maps.google.com/maps?q=Scottish+Rite+Hamilton+ON&loc:43.25911+-79.879494&z=15 and http://maps.google.com/maps?q=Scottish+Rite+Hamilton+ON&loc:43.25911+-79.879494&z=1 – ninjaPixel May 20 '15 at 10:16
  • When I've tried using q and loc together the q is used and the loc parameter is ignored. – Dave Barnett Jul 09 '19 at 07:48
  • @Dave Barnett if you are still on the site can you give an updated version because its not working for me – pm980 Feb 13 '20 at 22:56
11
http://maps.google.com/maps?q=58%2041.881N%20152%2031.324W

Just use the coordinates as q-parameter. Strip the z and t prameters. While z should actually just be the zoom level, it seems that it won't work if you set any.

t is the map type. Having that said, it's not obvious how those parameters would affect the result in the shown way. But they do.

Maybe you should try the ll-parameter, but only decimal format will be accepted.

You can find a quick overview of all the parameters here.

Leo
  • 37,640
  • 8
  • 75
  • 100
  • 1
    Your link pointed to the best answer - put "loc:" after "q=", as in http://maps.google.com/maps?z=11&t=k&q=loc:58 41.881N 152 31.324W – xpda Apr 17 '10 at 22:36
  • Cool thing, didn't know of this one. I would have created a custom marker, but this seems easier :) – Leo Apr 17 '10 at 22:40
  • How can we avoid highways and tolls using the URL? – CopsOnRoad Feb 11 '18 at 17:15
9

If you need a name on your pin, you can also use:

http://maps.google.com/?q=MY%20LOCATION@lat,long
Everton Cunha
  • 1,017
  • 8
  • 10
9

All the answers didn't work for me (the loc: and @ options). So here is my solution for the new Google maps (April 2014)

Use the q= for query description, for example the street or the name of the place. Use ll= for the lat, long coordinates.

You can add extra parameters like t=h (hybrid) and z=19 (zoom)

https://maps.google.com/?q=11+wall+street+new+york&ll=40.7060471,-74.0088901

https://maps.google.com/?q=new+york+stock+exchange&ll=40.7060471,-74.0088901

https://maps.google.com/?q=new+york+stock+exchange&ll=40.7060471,-74.0088901&t=h&z=19

Cerveser
  • 752
  • 8
  • 23
9

There have been a number of changes, some incompatible, since I asked this question 5 years ago. Currently, the following works properly:

https://www.google.com/maps/place/58°41.881N 152°31.324W/@58.698017,-152.522067,12z/

The first latitude/longitude will be used for the pin location and label. It can be in degrees-minutes-seconds, degrees-minutes, or degrees. The second latitude/longitude (following the "@") is the map center. It must be in degrees only in order for the zoom (12z) to be recognized.

For terrain view, you can append "data=!4m2!3m1!1s0x0:0x0!5m1!1e4". I can find no documentation on this, though, so the spec could change.

xpda
  • 15,585
  • 8
  • 51
  • 82
6

New Version queries have a different format

To reach a lat long by url use (e.g.)

https://www.google.com/maps/search/-15.924,-5.719

jpp
  • 194
  • 1
  • 7
4

works fine https://maps.google.de/maps?q=51.404989,13.091751&z=17&t=k

ddlab
  • 918
  • 13
  • 28
2

This doesn't have to be much more complicated than passing in a value for the 'q' parameter. Google is a search engine after all and can handle the same stuff it handles when users type queries into its text boxes

"maps.google.com?/q=32.5234,-78.23432"
boulder_ruby
  • 38,457
  • 9
  • 79
  • 100
  • You are correct. Google has changed to center the map on the coordinates instead of the nearest major object. The example in the original question works fine now. – xpda Nov 21 '13 at 01:55
1

This works to zoom into an area more then drop a pin: https://www.google.com/maps/@30.2,17.9820525,9z

And the params are:

@lat,lng,zoom
Chris Andersson
  • 1,291
  • 11
  • 16
0

If you only have degrees minutes seconds you can pass them on the url :

https://maps.google.com/maps?q=latDegrees latMinutes latSeconds longDegrees longMinutes longSeconds 

substitute in %20 for the spaces

WizardsOfWor
  • 2,974
  • 29
  • 23
-1

"ll" worked best for me, see:

http://mapki.com/wiki/Google_Map_Parameters (query reference)

it shall not be too hard to convert minutes, seconds to decimal

http://en.wikipedia.org/wiki/Decimal_degrees

for a marker, possibly the best would be ?q=Description@lat,long

ljgww
  • 3,418
  • 6
  • 19
  • 21
  • things change over time, especially for agile teams like Google. History of internet is one of problems. I would not expect that answer which perhaps was a solution in 2012 will still hold in 2014, 2017 or later... Sorry about that. Stack Overflow is full of historic quotes to things that do not exist any more. – ljgww Jul 30 '17 at 11:46