Maps extension
Installation and Configuration
Displaying maps
Customizing maps
    ↪  Leaflet  •  Google Maps
Displaying GeoJSON
Converting coordinates
SMW integration
Storing coordinates
Aggregating onto a map
    ↪  Leaflet  •  Google Maps
On this page

Extension "Maps" is installed and upgraded via Composer. For a detailed explanation see installing MediaWiki extensions with Composer.

In short:

  • Edit the "composer.local.json" file by adding mediawiki/maps to the require section
  • Choose the version constraint. Typically you want to pick ^x.y, where x.y is the latest minor version of Maps receiving only backwards-compatible code changes
  • Run composer update --no-dev -o in the MediaWiki root directory

For upgrading, edit the "composer.local.json" file and update the version constraint.

Example of a require section just with Maps:

    "require": {
        "mediawiki/maps": "^7"

If you would also like to make use of the semantic functionality Maps provides you also need to install Semantic MediaWiki. In this case the example require section with both Maps and Semantic MediaWiki looks like this:

    "require": {
        "mediawiki/maps": "^7",
        "mediawiki/semantic-media-wiki": "^3.0"

You will need a comma behind each version constraint except the last one.

Then run composer update --no-dev -o.

As of Maps version 6.0, you need to load the extension in your "LocalSettings.php" file. This is done using the standard MediaWiki extension loading method:

wfLoadExtension( 'Maps' );
require_once __DIR__ . '/extensions/Maps/Maps_Settings.php';

This is an example of what your "LocalSettings.php" file might look like:

## Maps
wfLoadExtension( 'Maps' );
require_once __DIR__ . '/extensions/Maps/Maps_Settings.php';
$egMapsDefaultService = 'leaflet'; // Not required, just an example for adding configuration

This is an example of a "LocalSettings.php" file with both Maps and Semantic MediaWiki:

## Maps
wfLoadExtension( 'Maps' );
require_once __DIR__ . '/extensions/Maps/Maps_Settings.php';
$egMapsDefaultService = 'leaflet';

## Semantic MediaWiki
enableSemantics( '' );

Verify installation success[edit]

As final step, you can verify Maps got installed by looking at the Special:Version page on your wiki and verifying the Maps extension is listed.


Maps works out of the box without any configuration work being required. Below are some key configuration options that you might want to change. For a comprehensive overview of all settings, see Maps Configuration.

Mapping service[edit]

The Maps extension supports displaying maps using multiple mapping services, including Google Maps, Leaflet and OpenLayers. At present the default is Leaflet, while in older versions of the extension it was Google Maps.

If you do not wish to use the default, use the $egMapsDefaultService configuration parameter. Examples:

  • For Google Maps:
    $egMapsDefaultService = 'googlemaps3';
  • For Leaflet:
    $egMapsDefaultService = 'leaflet';

When using Google Maps, you will need to provide your Google API key:

$egMapsGMaps3ApiKey = 'your-api-key';

Geocoding service[edit]

The Maps extension supports geocoding, the conversion of human readable addresses to coordinates. This is done via a webservice used for each map displayed on your wiki. By default Maps uses Nominatim. To use a different geocoding service, use the $egMapsDefaultGeoService.

$egMapsDefaultGeoService = 'google';


When upgrading from Maps older than 6.0 to Maps 6.0 or later, you will need to load Maps in your "LocalSettings.php" file. This is done using the standard MediaWiki extension activation method. If you are using customized settings, you will also need to include the default settings. See the configuration instructions. See the examples shown above for installing this extension.

Platform compatibility[edit]

See the compatibility table on GitHub.