Extension:Kartographer

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:Kartographer and the translation is 4% complete.
Other languages:
Manuel des extensions MediaWiki
OOjs UI icon advanced-invert.svg
Kartographer
État de la version : stable
Complex map - marker, article link and image.jpg
Implémentation Balise
Description Allows to add maps to pages as a frontend to mapping services
Auteur(s) Yuri Astrakhan (yurikdiscussion)
MediaWiki 1.36+
PHP 7.2
Modifie la base
de données
Non
Licence Licence MIT
Téléchargement
Aide Help:Extension:Kartographer/fr
Exemple See below on this page
  • $wgKartographerSrcsetScales
  • $wgKartographerUsePageLanguage
  • $wgKartographerStaticMapframe
  • $wgKartographerDfltStyle
  • $wgKartographerFallbackZoom
  • $wgKartographerMapServer
  • $wgKartographerWikivoyageMode
  • $wgKartographerEnableMapFrame
  • $wgKartographerUseMarkerStyle
  • $wgKartographerStyles
* mapframe
  • maplink
Traduire l’extension Kartographer sur translatewiki.net si elle y est disponible

Vérifier la matrice des utilisations et des versions.

Problèmes Tâches ouvertes · Signaler un bogue

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.

The tile server at maps.wikimedia.org is not available to 3rd parties. Please use your own tileserver. If you are a Wikimedia affiliate, see wikitech:Maps/External usage instead.

Kartographer defines the wikitext tags ‎<mapframe>...‎</mapframe> and ‎<maplink>, which display a map and a link to a map on the page respectively. See Aide : Extension : Kartographer for how to call these tags.

Example

Map of London


Installation

  • Install the JsonConfig extension as described in its documentation which is required to run this extension.
  • Téléchargez et placez le(s) fichiers (s) dans un répertoire appelé Kartographer dans votre dossier extensions/.
  • Seulement lorsque vous installez à partir de Git, exécutez Composer pour installer les dépendances PHP, en entrant composer install --no-dev après vous être positionné dans le répertoire de l'extension. (Voir tâche T173141 pour des complications potentielles.)
  • Ajoutez le code suivant à la fin de votre fichier LocalSettings.php :
    wfLoadExtension( 'Kartographer' );
    
  • Configure as required.
  • Yes Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.

Pour les utilisateurs de MediaWiki 1.24 ou précédents :

Les instructions ci-dessus décrivent la nouvelle procédure pour installer cette extension en utilisant wfLoadExtension(). Si vous avez besoin d'installer cette extension sur les précédentes versions de MediaWiki (1.24 ou antérieur), à la place de wfLoadExtension( 'Kartographer' );, vous devez utiliser :

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

Configuration

Configuration settings
parameter default comment
$wgKartographerMapServer
false
Server providing the map tiles. The tile server at maps.wikimedia.org is not available to 3rd parties. See openstreetmap:Tile servers for tile servers.
$wgKartographerStyles
["osm-intl", "osm"]
Available map styles on $wgKartographerMapServer
$KartographerDfltStyle
"osm-intl"
The default map style to use
$wgKartographerUseMarkerStyle
false
Allows Kartographer to extract CSS style to be used by the link from the GeoJSON.
$wgKartographerWikivoyageMode
false
Enables Wikivoyage mode.
$wgKartographerStaticMapframe
false
Defines if the map will be a static image. Requires a static map renderer like Kartotherian and $wgKartographerEnableMapFrame to be true.
$wgKartographerEnableMapFrame
true
Enables the ‎<mapframe> tag to be used to create static or interactive maps.
$wgKartographerUsePageLanguage
true
Use the language of the page instead of that of the language of the territory mapped. This sets the lang parameter of the tiles requested.
$wgKartographerFallbackZoom
13
Fallback zoom value when zoom is undefined

API

This extension provides two internal APIs.

Implementation

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. Third party installations should use non-Wikimedia tile servers listed on openstreetmap:Tile servers
      • Example, for maps in French with this setting in LocalSettings.php
$wgKartographerMapServer = 'https://tile.openstreetmap.fr';
$wgKartographerDfltStyle = 'osmfr';
  • 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

General goals

  • 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

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.

Known problems

See the corresponding project(s) in Phabricator for a complete list of bugs.

Conflict with FlaggedRevs

Because of technical issues, some Wikipedias that implement a specific setting of Extension:FlaggedRevs cannot show the mapframe tag.

See phab:T191585 and phab:T151665 for more information.