Extension:SimpleMaps
Appearance
Release status: stable |
|
|---|---|
| Implementation | Parser function |
| Description | Displays interactive maps in MediaWiki using the {{#display_map:}} parser function |
| Author(s) | jmnote |
| Latest version | 0.2.2 (2026-07-05) |
| MediaWiki | 1.39+ |
| Database changes | No |
| Licence | Apache License 2.0 |
| Download | README |
The SimpleMaps extension displays interactive maps directly in MediaWiki pages.
It adds the {{#display_map:}} parser function for embedding maps with markers, shapes, and GeoJSON overlays. Maps are rendered with Leaflet.
The extension can convert address strings to coordinates using OpenStreetMap Nominatim. Geocoding and GeoJSON API responses are cached server-side.
Features
[edit]- Renders interactive maps with Leaflet
- Supports markers, lines, polygons, circles, and rectangles
- Converts address strings to coordinates with OpenStreetMap Nominatim
- Supports GeoJSON overlays from a URL or place query
- Provides the
{{#display_map:}}parser function - Supports configurable default map size, zoom level, marker color, shape color, and Leaflet distribution URL
- Caches geocoding and GeoJSON API responses server-side using
WANObjectCache
Installation
[edit]- Download and place the file(s) in a directory called
SimpleMapsin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'SimpleMaps' );
Done – Navigate to Special:Versionon your wiki to verify that the extension is successfully installed.
Configuration
[edit]You can override the default values defined in extension.json using these variables:
$wgSimpleMapsWidth = '100%';
$wgSimpleMapsHeight = '400px';
$wgSimpleMapsZoom = 14;
$wgSimpleMapsMarkerColor = 'blue';
$wgSimpleMapsShapeColor = 'red';
$wgSimpleMapsLeafletDistUrl = 'https://unpkg.com/leaflet@1.9.4/dist/';
Usage
[edit]Basic map
[edit]{{#display_map: center=Seoul | zoom=12 }}
Single marker
[edit]{{#display_map: Seoul | center=Seoul | zoom=10 }}
Multiple markers
[edit]{{#display_map: Seoul~Seoul~Capital of South Korea~red; Busan~Busan~Port City~blue }}
Scroll zoom
[edit]scrollzoom is the primary parameter. scrollwheelzoom is kept as an alias for backward compatibility.
{{#display_map: Seoul | scrollzoom=off }}
GeoJSON
[edit]{{#display_map: geojson=Berlin | height=300px | scrollzoom=off }}
For non-URL values, the extension calls Nominatim with the following request format:
https://nominatim.openstreetmap.org/search?format=geojson&polygon_geojson=1&limit=1&q=<query>
Shape examples
[edit]{{#display_map:
lines=37.5665,126.9780:35.1796,129.0756~Seoul-Busan line~sample~#2563eb~0.8~3
| polygons=37.58,126.97:37.57,127.00:37.55,126.99~Area~sample~#dc2626~0.8~2~#dc2626~0.2
}}
Notes
[edit]- Geocoding and
geojsonAPI responses are cached server-side usingWANObjectCache. - If geocoding fails, invalid points are skipped and valid points continue rendering.
- When using address geocoding or non-URL
geojsonqueries, the extension may request data from OpenStreetMap Nominatim. - If the configured Leaflet distribution URL points to an external CDN, client browsers must be able to access that URL.
- The
{{#display_map:}}parser function is inspired by the familiar map embedding syntax used by existing MediaWiki map extensions such as Extension:Maps. - SimpleMaps is intended to provide a lightweight alternative focused on Leaflet-based rendering, basic markers, shapes, and GeoJSON overlays.
