Maps/Installation

From semantic-mediawiki.org
Maps extension
Overview
Installation and Configuration
Usage
Displaying maps
Customizing maps
Displaying GeoJSON
Geocoding
Converting coordinates
SMW integration
Storing coordinates
Aggregating onto a map
On this page

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

In short:

  • Edit composer.local.json (preferred) or composer.json 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 or php composer.phar update depending on how you installed Composer.


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

Example of a require section just with Maps:

    "require": {
        "mediawiki/maps": "^6"
    }

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": "^6",
        "mediawiki/semantic-media-wiki": "^2.5"
    }

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

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

wfLoadExtension( 'Maps' );

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.

Configuration[edit]

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';
    
  • For OpenLayers:
    $egMapsDefaultService = 'openlayers';
    

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 $settingegMapsDefaultGeoService.

$egMapsDefaultGeoService = 'google';

Upgrading[edit]

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.

wfLoadExtension( 'Maps' );

If you are using customized settings, you will also need to include the default settings. See the configuration instructions.

Platform compatibility[edit]

See the compatibility table on GitHub.