Simple image MediaWiki Extension
This page describes a simple image MediaWiki extension. See MediaWiki extension for details of other ideas / enhancements we could develop.
The extension is now installed and 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="51.485" lon="-0.15" z="11" w="300" h="200" format="jpeg" />
There should be no contents placed between start and end tags <map>xxxx</map>
The syntax results in a map! :
The extension simply spits out an <IMG> tag with the src set to StaticMapsLite URLs like this one: http://staticmap.openstreetmap.de/staticmap.php?center=51.485,-0.15&zoom=11&size=300x200&maptype=mapnik
It used to supports this old format with '|' pipe characters:
This is no longer supported. Any pages using that will see an error
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)
- Download the three files which make up this extension. Right-click the links and do 'save as'
- Save them into a folder called 'SimpleMap'
- Upload this into your mediawiki installation in the 'extensions' subdirectory
- Edit your 'LocalSettings.php' file. Add the following lines:
//openstreetmap extension include("extensions/SimpleMap/SimpleMap.php"); $wgMapOfServiceUrl = "http://osm-tah-cache.firefishy.com/~ojw/MapOf/?"; //$wgMapOfServiceUrl = "http://tah.openstreetmap.org/MapOf/?"; //$wgMapOfServiceUrl = "http://dev.openstreetmap.org/~ojw/MapOf/?";
- Try it out! e.g. Stick the map syntax example above on your 'SandBox' page.
This introduces a dependency between your wiki and the image generating service running on the openstreetmap server. If openstreetmap.de ceases to provide images under these URLS (http://staticmap.openstreetmap.de/staticmap.php ), 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.
We are offering no guarantees about the long-term continuation of this (or indeed any) openstreetmap service. This particular service is experimental, and may be particularly prone to down-time or being moved to a new URL. 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.
Who's working on it
- Harry Wood
- 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: https://github.com/Firefishy/SimpleMap