Simple image MediaWiki Extension
- About
- Simple Image MediaWiki extension (name in the source code SimpleMap) was an extension of MediaWiki that allowed to include maps as static images.
- Reason for being historic
- The extension required a provider for static map images. Previous providers stopped their services and nobody was interested in running such a service specifically for this wiki.[1]
- Captured time
- December 2018, minor edits thereon
This page describes a simple image MediaWiki extension. See MediaWiki extension for details of other ideas / enhancements we could develop.
The extension was installed and was running on this wiki. It simply puts a map image on the wiki page by referencing StaticMapsLite.
The extension supports wiki markup of the form
<map lat="54.7335" lon="20.5616" z="15" w="200" h="200" format="jpeg" />
There should be no contents placed between start and end tags <map>xxxx</map>
The syntax results in a map, looking approximately like this tile:
The extension simply spits out an <IMG> tag with the src set to a static map image generating service. We've swapped to different services with this a couple of times over the years. Currently it's pointed at one run by wikimedia.
Old syntax
It used to supports this old format with '|' pipe characters:
<map>lat=51.485|lon=-0.15|z=11|w=300|h=200|format=jpeg</map>
This is no longer supported. Any pages using that will see an error
MediaWiki Versions
Harry Wood originally developed this to work on his old version 1.4 MediaWiki installation, but it has since been rewritten, and probably requires v1.6 onwards (unverified). It seems to be quite an old style extension code compared to the latest mediawiki stuff. All needs updating really.
Installation
- Download (or git clone/export) the three files which make up this extension.
- Upload the 'SimpleMap' directory into your mediawiki installation in the 'extensions' subdirectory
- Edit your 'LocalSettings.php' file. Add the following (it's an old style extension) :
//openstreetmap extension
include("extensions/SimpleMap/SimpleMap.php");
- Try it out! e.g. Stick the map syntax example above on your 'SandBox' page.
Dependency note
This introduces a dependency between your wiki and the image generating service.
As of December 2018, we've just switched to using a static map image service provided by wikimedia (hence the same style seen at https://maps.wikimedia.org).
That was away from the instance of StaticMapLite being provided by openstreetmap.de . Although this is still available, it's currently broken for anyone running a httpS site (as this wiki is)
Sadly these static map image services can cease to provide images under these URLS at short notice. If this happens for whatever reason, then your wiki will still function, but it will show image errors. The width and height of the image are specified explicitly in the output HTML, so most browsers will fetch and browse around the rest of your wiki without being slowed down by images failing to load.
The php extension can be swapped to different static map services which might be offering different guarantees to you (though generally nobody is offering guarantees apart from maybe some paid options). The code is also easily customised to use URL schemes. If you are uncomfortable with that dependency, then you might run your own copy of StaticMapLite for example.
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: https://github.com/Firefishy/SimpleMap