Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
Geohack tools.wmflabs.org/geohack/… –  Mapperz Jul 3 '13 at 14:49
add comment

3 Answers

up vote 2 down vote accepted

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

share|improve this answer
    
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 Jul 3 '13 at 18:13
add comment
  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)

share|improve this answer
add comment

OpenStreetMap offers quite a lot of options for linking to the maps. These are described on the documentation about browsing the map. To summarise with the example coordinates you gave, you can use a URL like

http://www.openstreetmap.org/?lat=30.486&lon=-90.195&zoom=16 ...to link to that location

http://www.openstreetmap.org/?mlat=30.486&mlon=-90.195&zoom=16 ...with a marker

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, check out the 'export tab' 'embeddable HTML' options 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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