Slippy Map MediaWiki Extension

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Slippy Map MediaWiki Extension
Afrikaans Alemannisch aragonés asturianu azərbaycanca Bahasa Indonesia Bahasa Melayu Bân-lâm-gú Basa Jawa Baso Minangkabau bosanski brezhoneg català čeština dansk Deutsch eesti English español Esperanto estremeñu euskara français Frysk Gaeilge Gàidhlig galego Hausa hrvatski Igbo interlingua Interlingue isiXhosa isiZulu íslenska italiano Kiswahili Kreyòl ayisyen kréyòl gwadloupéyen kurdî latviešu Lëtzebuergesch lietuvių magyar Malagasy Malti Nederlands Nedersaksies norsk norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português română shqip slovenčina slovenščina Soomaaliga suomi svenska Tiếng Việt Türkçe Vahcuengh vèneto Wolof Yorùbá Zazaki српски / srpski беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް
Slippy Map MediaWiki Extension
Screenshot of Slippy Map MediaWiki Extension
Authors: Harry Wood, Firefishy, JeLuF, raimond spekking
Source code: Blacktocat.svg Firefishy/SlippyMap

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 spits out the javascript which launches OpenLayers within a sized DIV


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 used to use an old format which is no longer supported: <slippymap>lat=51.485|lon=-0.15|z=11|w=450|h=330|layer=osmarender</slippymap> and all the wiki pages switched 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 a GitHub repo: Blacktocat.svg Firefishy/SlippyMap
  • 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!

MediaWiki Versions

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.

Dependency note

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

  • Can't embed two different slippy maps on the same wiki page. This is because all the javascript variable names and the 'id=map' document object cease to be unique. Fixable with a bit of hacking.
  • '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)

Enhancement ideas

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
  • Firefishy
  • JeLuF and raimond spekking did some stuff over at
  • Feel free to join in

The extension code

The code has been re-homed in several confusing ways over the years. On this wiki page -> OSM's svn -> Mediawiki's SVN -> wikimedia gerrit. These days this wiki is pulling from: Blacktocat.svg Firefishy/SlippyMap

Also See