4

Is there a way to embed a latitude longitude coordinate pair within a url link to search for a location on either OpenStreetMap, Google and/or Bing Maps? I'd like to use the url link within Excel, LibreOffice and within an html pages. I have tables with coordinates that I'd like to configure with a link to show its location on a map, without building an online mapping application.

If not, then is there a simple javascript that I can encapsulate the coordinate within and fetch that from OpenStreetMap, Google and/or Bing Maps?

It seems like the url would be something like the following, but I can't get this to work: http://www.openstreetmap.org/?30.486,-90.195

1

3 Answers 3

4

there is a way of doing it. Example: http://www.openstreetmap.org/?lat=12.345&lon=12.345&zoom=17&layers=M fomr here

For google there is a similar question

Bing example - http://www.bing.com/maps/?v=2&cp=53.02102351~-1.48398532&lvl=16&dir=0&sty=c as taken from the question posted here

1
  • Mark and Paul, I got these to work as links inside a spreadsheet or a standard html page. But, I noticed that OpenStreetMap doesn't if linked from within a FRAME window of an html page (the map doesn't show up, but the OpenStreetMap menu's do). To fix that I The Google link does work from inside a html FRAME window. To get OpenStreetMaps to work from with a FRAME window, I had to an IFRAME like so... <iframe width="500" height="200" frameborder="0"
    – user12711
    Commented Jul 3, 2013 at 18:13
4

These days you can just copy the URL from your browser address bar which should look something like this (with your example coordinates) :

https://www.openstreetmap.org/#map=16/30.486/-90.195

(Note: this dynamically updated '#' character URL structure was introduced some time after the original question was asked)

OpenStreetMap offers quite a lot of other options for linking to the maps, some of which are available by clicking the "Share" button to access a right-hand panel there. These are also described on the documentation about browsing the map.

e.g. https://www.openstreetmap.org/?mlat=30.486&mlon=-90.195#map=16/30.486/-90.195 ...puts a marker at those coordinates

http://osm.org/go/Tu_z5cFR ...as a 'short link' (redirects)

http://osm.org/go/Tu_z5cFR?m ...a 'short link' with marker

You can actually slap in a coordinate pair "30.486,-90.195" with a comma into the search box on the OpenStreetMap homepage, and that gives you a link to click, which dynamically zooms you to that spot, although you can also right click to open the link in a new window at a URL formatted as above.

If you want a frame embeddable map, use the Share panel 'HTML' option documented here which gives you HTML like this:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.openstreetmap.org/export/embed.html?bbox=-90.20224,30.48102,-90.18775,30.49097&amp;layer=mapnik" style="border: 1px solid black"></iframe><br /><small><a href="http://www.openstreetmap.org/?lat=30.485995000000003&amp;lon=-90.194995&amp;zoom=15&amp;layers=M">View Larger Map</a></small>

Contained with that is a URL like this...

http://www.openstreetmap.org/export/embed.html?bbox=-90.20224,30.48102,-90.18775,30.49097&layer=mapnik

All of these URL formats could be generated by Excel using a formula to go from the lat/lon values in two other cells.

3
  1. If you click the Permalink button at the bottom right of the screen, it will give you the syntax you want.
    http://www.openstreetmap.org/?lat=30.486&lon=-90.195&zoom=8&layers=M
    You can chop off the zoom level and layers if you don't need them.

  2. http://maps.google.com/maps?q=30.486+-90.195 (the + is necessary)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.