While you're making an effort to contribute some data to OpenSourceMap, you may also want to share the results of your efforts with others. If your data starts to form a interesting map, you may want to share with others. This chapter describes how you can offer your maps to other people or organizations.
First you must know that the openstreetmap.org website offers permanent, unchanging links to a location with longitude and latitude values, using a neat trick in the URL itself to tell the site what location you want it to display. These links are easy to retrieve on a map. On the openstreetmap.org site, just click Permalink or Shortlink in the lower right area of a map when you're on the View tab.
When you click Permalink in a map, this action populates your browser address bar with the permalink URL, which you can then share with others by copying and pasting into emails, online forums, blog comments, and so on. You must be on the View tab to see the Permalink option.
Here's the anatomy of a Permalink with all the possible parameters you can use:
http://www.openstreetmap.org/index.html?lat=[Latitude]&lon=[Longitude]&zoom=[Zoom Level]&layers=[Layer code]
Location (lat and lon): Latitude and longitude are in lat and lon values, which are represented as mlat and mlon when you want to indicate a marker. You can enter up to six digits after the decimal point for these values.
Zoom: The zoom level is a value from 1, representing your map on the entire Earth, zoomed all the way out, to 18, which shows it a map within walking distance. To see your map or marker within a country, for example, try a zoom level of 6 or 8.
Layers: Layers are optional and the default is "Mapnik" or layers=M. Layers give you another "skin" on the map. You can use the default, or use O for an OpenStreetMap renderer, or use layers=C for a Cyclemap view.
Layers are handy when you want to find safe bicycling routes, for example. You can also click the plus symbol to see a list of the layers and choose another layer, which then appears in the Permalink in the browser address bar. The differences mostly show in the colors and fonts displayed on the map.
As you can see, the Permalink yields a rather long URL, since it contains all the data about the map you're viewing. If you prefer short URLs, you can right-click the Shortlink text in the lower right corner of the map and get the link through your browser's link properties or a Copy Link Location menu. Here is an example of a shortlink to Austin, Texas: http://osm.org/go/Ts0q_IBJ--.
If you double-click the map to center the where you want to highlight a location, your short link can go to a centered map with that marker icon in the middle if you add '?m' to the end of the URL. For example, this shortlink goes to the Austin Convention Center and has a marker at the corner of 4th and Trinity, http://osm.org/go/Ts0q7wU3?m.
These shortlinks are great for sending IMs or text messages, or using Twitter or Facebook for encouraging click-throughs to your map.
Embedding a map on a web page
If you want to have a map for directing people to the trailhead for a bike ride or the starting point for a pub crawl, for example, you may want to get HTML to embed in a page. People can then refer to your map on their smart phone, or print it from your site. You can easily get the code to embed a map on a web page from OpenStreetMap. Here's how:
- On the View tab, find the address or location by zooming and dragging the map so that it looks the way you want it to.
- Go to the Export tab and under the heading "Format to Export", choose "Embeddable HTML".
- Optionally, add a marker to the map under Options by clicking "Add a marker to the map" and then double-clicking on the map to add the marker and center the map on that point.
- Under "Output", copy the HTML code.
- Paste the HTML code into the web page in which you want to embed the map.