Hi,

I'm using Openstreetmap to show the location of faculties on a map. Now, is there any way to pass a url with the name of the location and to get embeddable html code for the location on the map?

For example:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" 
marginwidth="0" src="http://www.openstreetmap.org/export/embed.html?
  bbox=18.396367,43.855225,18.40038,43.858146&amp;layer=mapnik"
style="border: 1px solid black"></iframe><br />
<small><a href="http://www.openstreetmap.org/?lat=43.8566855&amp;
   lon=18.3983735&amp;zoom=17&amp;layers=M">View Larger Map</a></small>

So, is there any way to pass the name of the location in a url, because I would like to show maps dynamically (based on location from a mysql table).

Thanks in advance,

Amer

asked 18 Apr '11, 11:57

aldm's gravatar image

aldm
31223
accept rate: 0%

edited 19 Apr '11, 09:33

sleske's gravatar image

sleske
4.0k115377


No, there is no direct way to to this as far as I know. It would be difficult to imagine how this should work, because often location names will be ambiguous (there are even cities with multiple streets with identical names).

What you can do is use a geolocation service (such as Nominatim) to get the coordinates of a place, then use that to display the map. Nominatim for example can be queried over the web (the wiki page lists the URLs and parameters).

Finally, if the list of locations to be shown is known in advance (there are only so many faculties, after all), it's probably easier to get the coordinates once (possibly by hand), then use them directly.

permanent link

answered 19 Apr '11, 09:42

sleske's gravatar image

sleske
4.0k115377
accept rate: 25%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×30
×29
×24

question asked: 18 Apr '11, 11:57

question was seen: 6,724 times

last updated: 19 Apr '11, 09:42

powered by OSQA