Extension:Kartographer

From MediaWiki.org
Jump to navigation Jump to search


MediaWiki extensions manual
Crystal Clear action run.svg
Kartographer
Release status: beta
Implementation Tag
Description Allows to add maps to pages as a frontend to mapping services
Author(s) Yuri Astrakhan (yuriktalk)
MediaWiki 1.27+
PHP 5.5+
Database changes No
License MIT License
Download
Example See below on this page
Parameters
  • $wgKartographerStaticMapFrame
  • $wgKartographerWikivoyageMode
  • $wgKartographerstyles
  • $wgKartographerSrcsetscales
  • $wgKartographerMapServer
  • $wgKartographerIconServer
  • $wgKartographerFrameMode
  • $wgKartographerUseMarkerStyle
  • $wgKartographerEnableMapFrame
Tags
* mapframe
  • maplink
Hooks used
ParserFirstCallInit
ParserAfterParse
Translate the Kartographer extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

The Kartographer extension lets you display maps (based around OpenStreetMap) in wiki pages. It was specifically designed in order to run on Wikimedia sites such as Wikivoyage and Wikipedia, although it can be used on any wiki.

Usage[edit]

Kartographer defines the wikitext tags <mapframe> and <maplink>, which both display a map on the page. See Help:Extension:Kartographer for how to call these tags.

Example[edit]

Map of London


Installation[edit]

  • Download and place the file(s) in a directory called Kartographer in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Kartographer' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'Kartographer' );, you need to use:

require_once "$IP/extensions/Kartographer/Kartographer.php";

Configuration[edit]

Configuration settings
parameter default comment
$wgKartographerWikivoyageMode
false
Enables Wikivoyage mode.
$wgKartographerUseMarkerStyle
false
Allows Kartographer to extract CSS style to be used by the link from the GeoJSON.
$wgKartographerStaticMapframe
false
Defines if the map will be a static image.
$wgKartographerEnableMapFrame
true
Enables the tag <mapframe> to be used and create static or interactive maps.

Implementation[edit]

Kartographer makes use of a suite of open-source, open-data tools for displaying maps:

  • On the client side (within the browser):
    • Leaflet, a JavaScript mapping library
  • On the server side:
    • Kartotherian, a map tile service developed by the Wikimedia Foundation, which itself contains code from Mapbox
  • Generating the data in advance:
    • Tilerator, a tile pre-generation service also developed by the Wikimedia Foundation
    • OpenStreetMap, an open map data source, the source for the map data as well as for most of the points of interest (POIs).

For more information on these, see Maps#Production maps cluster. For more information on the production aspects of running these services, see the Wikitech Maps page.

Goals[edit]

General goals[edit]

  • A simple method to insert a map into an article without requiring common.js code changes
  • Ability to add extra information (marks, area, popups, text, links) to the map
  • Ability to gather map usage statistics (KPI) to better gauge how and what should be improved.
  • TBD: experimentation - if the user is aware of the privacy implications, the map should be able to show external data from non-production source, e.g. wmflabs. Static, server-side rendered images will not include the extra data added via this method until the extra data source is hosted in the secure production environment and can be shown without the user action.

Wikivoyage goals[edit]

Wikivoyage tends to have a large number of points of interest (POIs), such as museums and restaurants, listed on a page (see example and scroll down to the "See" section). Each POI is usually added with a template, but all of them should appear on the same map. Also, each POI should be referable by showing an icon with a number, both in the text of the article, and on the map:

  • Ability to incrementally add features to the map. For example, each usage of the restaurant template adds a single POI, and the map shows all of them.
  • Added features need to be indexable. E.g. the first restaurant template would show [1] on the page, and map would show POI as a clickable [1] element. There could be multiple index counters at the same time, each for its own type of POIs.