Slippy Map MediaWiki Extension
This page describes a Slippy Map MediaWiki extension. See MediaWiki extension for details of other ideas / enhancements we could develop. This extension embeds an OpenLayers slippy map into the contents of the wiki page, for example:
Wiki users can add a 'slippymap' tag into the page wiki-text. In this they can specify parameters 'lat', 'lon', 'z' (zoom level), 'w' (width in pixels), 'h' (height in pixels), and 'layer' (mapnik, transport, or cycle)
The extension allows anyone to embed a slippy map on a page with following syntax in the wikitext:
<slippymap lat="51.485" lon="-0.15" z="15" w="450" h="300" format="jpeg" layer="mapnik"/>
To find the suitable lat/lon values, open a new browser window, look at the front page map and use the 'permalink' feature in the bottom right.
Note that the extension installed here also supports an old format: <slippymap>lat=51.485|lon=-0.15|z=11|w=450|h=330|layer=osmarender</slippymap>, but we should edit all the wiki pages to switch over to the new format.
Download & Installation
If you're running your own mediawiki, you can set it up to support <slippymap> tags by installing the extension as follows:
- Download the each of the files which are currently hosted in our OSM subversion repo: http://svn.openstreetmap.org/applications/utils/wiki-extensions/SlippyMap-local/
- In your mediawiki installation (via FTP/shell) create a new directory 'slippymap' under 'extensions'
- Upload the files into this new directory
- Edit your 'LocalSettings.php' file. Add an 'include' line:
- include("extensions/slippymap/SlippyMap.php"); //openstreetmap extension
- Try it out!
Harry Wood originally created this to run on a really old v1.4 MediaWiki installation. The newer version probably isn't so backward compatible though.
This introduces a dependency between your wiki and the various openstreetmap tile servers. If openstreetmap ceases to provide images under these URLs, for whatever reason, then your wiki will still function, but it will show image errors.
We are offering no guarantees about the long-term continuation of this (or indeed any) openstreetmap service. Equally the extension code may be re-written, and you should aim to use the latest code available here. e.g. for security fixes.
There are a number of limitations and things which could be enhanced. The MediaWiki extension page has lots of ideas for this.
Known issues / ideas
- 'Data from OpenStreetMap' overlayed text should be vertically positioned slightly lower
- Have you looked at the possibility of overriding the attribution control to display what you want? It can be styled with CSS. Bobkare 14:50, 27 February 2008 (UTC)
- It snaps to 0/0 lat/lon when you do something with mouse. Can't work out what exactly.
- I think I know when this happens: click first on [wiki], close window and drag the map. --Willem1 19:22, 15 May 2009 (UTC)
Add ideas here, or on the talk page
- Support adding a marker or multiple pins.
- Currently disabled while we decide best wiki syntax
- Ideally follow the same g-maps extension syntax
- Could provide a param option to disallow slippiness (useful?)
- Display localized tiles from the Wikimedia Toolserver
- Ability to display other slippy map tiles, e.g. from ITO Map
Who's working on it
- Harry Wood
- JeLuF and raimond spekking did some stuff over at mediawiki.org
- Feel free to join in
The extension code
This is in our old SVN repo: http://svn.openstreetmap.org/applications/utils/wiki-extensions/SlippyMap-local/
For a while it was also in MediaWiki's SVN and documented on that site
For more info on subversion see Getting The Source. As with any changes made within subversion, changes don't get deployed to the live OSM servers until one of the System Administrators does it (User:TomH is the man to talk to). This may mean that the latest code you see there is not the code running on this OpenStreetMap wiki.