Use a URL to link to a Google map with a marker on it
Asked Answered
T

6

135

I want to link to google maps at a particular location with a marker on a particular point.

It's easy to link to a location:

http://maps.google.com/?ll=XX.XXXX,XX.XXXX

But how do I drop a marker at that point too? preferably with a bit of my own text but that's just a bonus.

2017 - Google has released documentation on this see new accepted answer: https://mcmap.net/q/167040/-use-a-url-to-link-to-a-google-map-with-a-marker-on-it

Toolmaker answered 5/7, 2011 at 12:43 Comment(1)
i can do it easily with the static map api, but i dont want to use that.Toolmaker
M
140

In May 2017 Google launched the official Google Maps URLs documentation. The Google Maps URLs introduces universal cross-platform syntax that you can use in your applications.

Have a look at the following document:

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

You can use URLs in search, directions, map and street view modes.

For example, to show the marker at specified position you can use the following URL:

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

For further details please read aforementioned documentation.

You can also file feature requests for this API in Google issue tracker.

Melpomene answered 10/6, 2017 at 20:15 Comment(9)
Thank you for taking the time to answer this again with a current answer!Toolmaker
If you’d like to add a text/label/title/name for the marker, you can a query param like q=36.26577,-92.54324+(My%20location). This however, does no longer seem to work for the Google Maps web site, but it (still) does for their iOS app.Imide
in my case this doesnt show the marker. How do i show the marker?Chinfest
Thanks you! Best answer!Aubervilliers
Is there a way to have multiple markers in different locations?Epileptoid
Unfortunately, multiple markers are not supported in Google Maps URLs.Melpomene
After spend 1 day on this problem,finally i found the best answer and that awesome link.Thank youMooneyham
It's a real shame that it's not possible to simply share a location with a custom name, like "Best mushroom spot ever", if it's not known by Google Maps.Hornswoggle
What I've encountered lately: If you use the "/search/" method, you can get a marker. If you use the "map-action=map" method, you will NOT get a marker, but you will also not have the left search panel. You will also have control of zoom. See = developers.google.com/maps/documentation/urls/…Firenze
C
94

This format works, but it doesn't seem to be an official way of doing so

http://maps.google.com/maps?q=loc:36.26577,-92.54324

Also you may want to take a look at this. They have a few answers and seem to indicate that this is the new method:

http://maps.google.com/maps?&z=10&q=36.26577+-92.54324&ll=36.26577+-92.54324

Christmastide answered 5/7, 2011 at 12:51 Comment(8)
this answer is outdated thanks to a new bug/feature in google maps, it now looks for the nearest address or something. to prevent this, prepend you coordinates with a "loc:". maps.google.com/maps?q=loc:36.26577,-92.54324Vickeyvicki
Is there any way how to do this with new Google Maps? I simply need to show marker on the map, which doesn't have any specific meaning (it could be in the middle of forest).Deportment
@Deportment peter's example above works for me in the new google mapsChristmastide
Edited to incorporate change suggested by @VickeyvickiSapers
maps.google.com/… Still not showing marker. The marker will be show if I change to satellite mode.Adorable
@Adorable I get the marker when I click on the url. Try opening it in incognito mode in chrome or something to make sure you don't have some local settings that are preventing it from showing upChristmastide
@AllenRice Yes, thank you. It is only my problem. (details here productforums.google.com/forum/#!topic/maps/… ).Adorable
I have moved the accepted answer to attract attention to this answer showing the new official google documentation: https://mcmap.net/q/167040/-use-a-url-to-link-to-a-google-map-with-a-marker-on-itToolmaker
B
40

If you want to include a zoom level, you can use this format:

https://www.google.com/maps/place/40.7028722+-73.9868281/@40.7028722,-73.9868281,15z

will redirect to this link (per 2017.09.21)

https://www.google.com/maps/place/40%C2%B042'10.3%22N+73%C2%B059'12.6%22W/@40.7028722,-73.9868281,15z/data=!4m5!3m4!1s0x0:0x0!8m2!3d40.7028722!4d-73.9868281

Balbo answered 16/1, 2015 at 19:0 Comment(2)
could one have just a zoom level and a place name instead of lat/lon?Unbearable
This seems to work well in 2019. Do you know if there's a way to specify satellite as map type?Embezzle
E
35

This URL format worked like a charm:

http://maps.google.com/maps?&z={INSERT_MAP_ZOOM}&mrt={INSERT_TYPE_OF_SEARCH}&t={INSERT_MAP_TYPE}&q={INSERT_MAP_LAT_COORDINATES}+{INSERT_MAP_LONG_COORDINATES}

Example for Mount Everest:

http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=27.9879012+86.9253141

Preview

Full reference here:

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

-- EDIT --

Apparently the zoom parameter stopped working, here's the updated format.

Format

https://www.google.com/maps/@?api=1&map_action=map&basemap=satellite&center={LAT},{LONG}&zoom={ZOOM}

Example

https://www.google.com/maps/@?api=1&map_action=map&basemap=satellite&center=27.9879012,86.9253141&zoom=14

Effective answered 9/6, 2015 at 8:24 Comment(4)
Best answer, imo, since it the format allows lots of customization - I was searching in particular for a way to change the map type to satellite. Thanks!Botzow
is there a way to make the marker have a name aswell? It only describes the coordinates as the name of the placeMerit
@EricDuminil I added the new format where the zoom parameter works!Effective
Your updated example does not place a pin like the earlier one does. I'm looking for a way of being able to place a pin, and not have the side panel appear. This does not seem possible?Halden
D
3

If working with Basic4Android and looking for an easy fix to the problem, try this it works both Google maps and Openstreet even though OSM creates a bit of a messy result and thanx to [yndolok] for the google marker

GooglemLoc="https://www.google.com/maps/place/"&[Latitude]&"+"&[Longitude]&"/@"&[Latitude]&","&[Longitude]&",15z" 

GooglemRute="https://www.google.co.ls/maps/dir/"&[FrmLatt]&","&[FrmLong]&"/"&[ToLatt]&","&[FrmLong]&"/@"&[ScreenX]&","&[ScreenY]&",14z/data=!3m1!4b1!4m2!4m1!3e0?hl=en"  'route ?hl=en

OpenStreetLoc="https://www.openstreetmap.org/#map=16/"&[Latitude]&"/"&[Longitude]&"&layers=N"

OpenStreetRute="https://www.openstreetmap.org/directions?engine=osrm_car&route="&[FrmLatt]&"%2C"&[FrmLong]&"%3B"&[ToLatt]&"%2C"&[ToLong]&"#Map=15/"&[ScreenX]&"/"&[Screeny]&"&layers=N"
Depicture answered 10/6, 2017 at 16:32 Comment(0)
T
0

2023 update:

I found a very easy way to implement this function.

From google maps, find your POI (point of interest) and click on it. on left handside opening menu you will see an icon Share and click.

A modal opens and you see a sharing link input box. Next to it you will see Copy link. Go to your url and paste it like;

<a href="https://goo.gl/maps/GJq5XvqhJnJsS8pU8" target="_blank">Drive to our office</a>

Voila, you are done.

Taxidermy answered 4/1, 2023 at 18:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.