Help:Extension:Kartographer/fr

The extension allows you to create interactive and static maps on Wikimedia wiki pages. This page is an exhaustive reference for using Kartographer, including the many options available when using the tags, which embeds maps directly in wiki pages, and , which creates links to full-page interactive maps, and touches on the elements of GeoJSON supported by Kartographer. You'll find a wealth of examples at the bottom of the page.

For a less technical quick start, check out Getting started. For help with Kartographer in the VisualEditor, check out Help:VisualEditor/Maps. For help with Kartographer and OpenStreetMaps, check out Help:Extension:Kartographer/OSM.

Basic map syntax
To place a map or a map link directly on a wiki page, Kartographer offers two tags:, which embeds a map inline that links to a full-screen interactive map, and  , which creates rich text (with an optional marker) that links to a full-screen interactive map.

Some wikis wrap these tags in templates, such as Mapbox and Mapframe. Consult your local wiki's Kartographer help page to see if your wiki has templates -- or use the tags directly with this document as your guide.



The tag embeds a map in a wiki page. The tag must be either empty or contain GeoJSON. See below for more resources on writing GeoJSON.

Changer $mapframe en $maplink entraine la création d'un lien vers une carte en plein écran :

(string)
 * (numeric)

* = required

Self-closing tags
When not using GeoJSON, you can use  and   as self-closing, standalone tags.

Self-closing:

Enclosing GeoJSON:

GeoJSON
 { "type": "FeatureCollection", "features": [ {     "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.41816520690917,         37.79097260220947        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40786552429199,         37.799654055191525        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40185737609865,         37.796262984039544        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38743782043457,         37.80535070427755        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38005638122557,         37.795449103799726        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40941047668457,         37.81850557172186        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40357398986815,         37.81280993744834        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.39842414855956,         37.8071138637568        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.41181373596191,         37.78595317184089        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.39542007446289,         37.787674400057654        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.38649368286131,         37.78401144262929        ]      }    }  ] }

The and  tags can either be empty or contain valid GeoJSON, to annotate the map with markers, draw shapes, and apply a mask area.

For more detail on this broad topic, you can read this helpful introduction to GeoJSON as well as the full GeoJSON specification.

Markers
Maps that use GeoJSON may contain one or more markers to point out special locations. These markers are set using marker-specific keywords under the "properties" level in GeoJSON.

Kartographer prend en charge les spécifications simplestyle avec les icônes Maki (sous licence Creative Commons Zéro). Aide:Extension:Kartographer/Icons contient une liste complète des icônes prises en charge.

Résultat :

Auto-counters
Multiple markers on a map can be grouped and named using patterns and counters. Below is a summary of styling attributes for items placed on a map using GeoJSON. For more information, see the simplestyle spec.

For a rich variety of examples, see the Examples section.

Shapes
GeoJSON allows you to add lines and geometric areas as annotations to your map. You can define simple inline shapes or import them from external databases.

Inline
GeoJSON allows you to draw points (markers), simple lines and geometric areas as part of your map definition. The following examples include the "geometry" attribute of GeoJSON objects inside a object. Consult the full GeoJSON specification for more information.

External data
 { "type": "ExternalData", "service": "geoshape", "ids": "Q797" }

GeoJSON allows you to obtain outlines of geographical objects from external sources using the "type" attribute with the value "ExternalData".

Maps can draw from well-known geographical objects in the OpenStreetMap database by using their Wikidata ID; they can also come from Wikidata SPARQL queries or from shapes in Wikimedia Commons (.map files).

Additionally, maps can link directly to raw GeoJSON stored on Wikimedia Commons: see for details.

Objects can be rendered using shape data from an external source in three different ways:


 * - Draws a simple line.
 * - Draws a polygon with a shaded interior.
 * - Draws a polygon and shades everything outside the polygon.

Shapes via Wikidata ID
 { "type": "ExternalData", "service": "geoshape", "ids": "Q34713,Q701153" }

Les IDs Wikidata sont relativement nouveaux pour la communauté OSM. Il y a environ [$url 1,9 million d'entités] avec des IDs renseignés. Pour en ajouter d’autres, visitez https://www.openstreetmap.org/ et ajoutez la propriété $wikidata avec la valeur $q (voir [$osm Key:wikidata sur le wiki d’OSM] pour une manière plus facile de faire cela). As of early 2022 there are roughly 1.9 million elements with Wikidata IDs. You can add your own at https://www.openstreetmap.org/ -- be sure to add the  tag and the corresponding   value. The data typically becomes available to Kartographer within two days. Learn more at the OSM wiki.

GeoShapes via Wikidata Query
 { "type": "ExternalData", "service": "geoshape", "query": "SELECT ?id ?head (SAMPLE(?img) as ?img_) (min(?partyId) as ?party) (if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill) (concat(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf  .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel" } Instead of a Wikidata Item ID, a map can also derive geoshapes from a Wikidata query in SPARQL. (You can create SPARQL queries using the Query Builder.)

For detailed instructions, see.

Données cartographiques de Commons
 { "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" } Les données cartographiques stockées sur Commons peuvent être dessinées sur la carte. Par exemple, c:Data:Neighbourhoods/New York City.map :


 * Plus d'information : 

Mask layer
 { "type": "ExternalData", "service": "geomask", "ids": "Q34713", "properties": { "fill": "#555555", "fill-opacity": 0.5, "stroke": "#000000", "stroke-width": 1, "stroke-opacity": 1 } }

A mask is just an inside-out shape, specified in the same way but with the exterior of the shape shaded.

Combinaison de plusieurs types de données
You can combine ExternalData, Feature, and FeatureCollection objects together in the same or  element, for example to highlight features with titles and descriptions on top of externally sourced objects.

Les données cartographiques de Commons peuvent être combinées avec d'autres types de données : See #Mixed types for various combinations.

Styling shapes
 { "type": "ExternalData", "service": "geoline", "ids": "Q2108", "properties": { "title": "Highway I-696", "description": "", "stroke": "#ffb100", "stroke-width": 8 } }

In addition to the marker styling above, lines and areas support these simplestyle properties:

Éléments qui se chevauchent
Les éléments de carte qui se chevauchent sont dessinés dans l'ordre dans lequel ils sont écrits dans le code. Par exemple, si une carte comprend deux lignes qui se chevauchent, la ligne définie en premier apparaîtra sous la ligne définie en second. Les exemples suivants montrent comment cela peut affecter l'apparence de la carte : If a map includes two lines that overlap, the line defined first will appear beneath the line defined next. This applies to any elements defined in the code that draw on the map.

Examples
 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ], [ 77.926025390625, -24.43714786161562 ], [ 77.926025390625, -25.150257104114733 ] ] ] } }, { "type": "Feature", "properties": {"stroke": "#fffa00","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ] ] } }, { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } } ] }

Le code de la carte ci-dessus comprend trois éléments, qui utilisent tous la fonctionnalité "feature" (entité) de GeoJSON. La première entité est un "Polygon" (polygone) - le rectangle rouge. Celle-ci est suivie de deux entités "LineString" (ligne). La ligne jaune est définie en premier, elle apparaît donc sous la ligne noire. Notez que la hiérarchie utilisée pour dessiner des éléments s'applique indépendamment du fait que les données sont des GeoJSON brutes ou proviennent d'un ID Wikidata ou d'une page de données de Commons.

La carte ci-dessous change l'ordre du premier exemple : la ligne noire est définie en premier et est donc déplacée au bas de la pile :

 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } }, { "type": "Feature", "properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0}, "geometry": { "type": "Polygon", "coordinates": [ [ [  77.926025390625,  -25.150257104114733  ],  [  80.14251708984374,  -25.150257104114733  ],  [  80.14251708984374,  -24.43714786161562  ],  [  77.926025390625,  -24.43714786161562  ],  [  77.926025390625,  -25.150257104114733  ]  ]  ]  } }, { "type": "Feature", "properties": {"stroke": "#fffa00","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ] ] } } ] }

Reference

 * Full GeoJSON specification (RFC7946)
 * GeoJSON on English Wikipedia
 * simplestyle spec used by Kartographer
 * Maki icon set used by Kartographer

Guides

 * HERE.com's intro to GeoJSON
 * A guide to the GeoJSON.io editor

Editors and tools

 * GeoJSON.io editor
 * Vector.rocks editor
 * GeoJSON linter to validate your GeoJSON

Groupes
Pour l'utilisation sur le projet Wikivoyage, il y a besoin d'afficher une carte pour laquelle les données sont définies quelque part ailleurs sur la page. Par exemple, il peut y avoir de multiples points d'intérêt (POI) définis par des balises $maplink et une carte commune sur un côté de la page les affichant tous. There may be multiple points of interest (POI) defined with tags, all of which appear on a single common map on the side of the page. (See an example using the city of Salzburg.)

Le concept de groupement permet aux contributeurs de partager des données entre plusieurs balises et.

Par défaut, les données internes à la balise ou  ne sont affichées que pour cette balise, et ne seront affichées nulle part ailleurs.

Si $mapframe ou spécifient l'attribut , les données dans ces balises seront placées dans un groupe nommé, avec l'ensemble des données ayant le même nom de groupe. Par conséquent, toute balise avec le même nom de groupe affichera les mêmes données cartographiques, et chaque balise pourra ajouter des données supplémentaires au groupe.

Each tag on a Wikivoyage tag displays an embedded map displaying the groups specified in its tag.

Une balise peut aussi afficher d'autres groupes, quelque soit son appartenance au groupe ou non, en spécifiant l'attribut. Plusieurs noms de groupe peuvent être spécifiés, séparés par des virgules. Le nom de groupe ne peut contenir que des lettres anglaises de bas de casse. La grille suivante montre quelles données sont affichées pour chaque balise.

Example:

Languages and fallbacks
Les étiquettes de carte essaieront d'utiliser la langue du wiki où la carte intégrée est affichée. Si cette langue n'est pas disponible, la carte utilisera la langue de secours comme décrit. If none of these are available, Kartographer will display no label.

Vous pouvez spécifier la langue à utiliser pour les étiquettes en ajoutant le  suivi de le code de langue souhaité. par exemple. lang="ja" pour afficher les étiquettes en japonais (si disponible).

Si vous souhaitez utiliser la langue locale dans une zone, vous pouvez utiliser. Cela montre les étiquettes de carte dans les langues de la zone cartographiée (essentiellement en désactivant l'internationalisation). Ce message donne plus de conseils sur quand et pourquoi, vous pouvez souhaiter utiliser lang="local" - et explique généralement comment fonctionnent les données multilingues d'OpenStreetMap. For more information about using the local language in your labels, and about OpenStreetMap multilingual data in general, read this post. Les cartes utilisent les données cartographiques, y compris les données d'étiquette de carte pour toutes les langues, issues du projet de cartographie open source OpenStreetMap. Si la carte que vous souhaitez afficher n'offre pas d'étiquettes dans la langue souhaitée, vous pouvez ajouter des étiquettes dans cette langue en les ajoutant à OpenStreetMap. Pour commencer, il existe un Guide des débutants OpenStreetMap, et des conseils sur les conventions de dénomination. If the map you want to display doesn't offer labels in the desired language, you can always add labels in that language by adding them yourself to OpenStreetMap. To get started, see the OpenStreetMap Beginners’ Guide and these best practices in naming conventions.

Simple
 { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] }, "properties": { "title": "Exploratorium", "description": "", "marker-symbol": "museum", "marker-size": "large", "marker-color": "0050d0" } }

Groups of automatic counters
 { "type": "FeatureCollection", "features": [ {     "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.41816520690917,         37.79097260220947        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40786552429199,         37.799654055191525        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40185737609865,         37.796262984039544        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38743782043457,         37.80535070427755        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38005638122557,         37.795449103799726        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40941047668457,         37.81850557172186        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40357398986815,         37.81280993744834        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.39842414855956,         37.8071138637568        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.41181373596191,         37.78595317184089        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.39542007446289,         37.787674400057654        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.38649368286131,         37.78401144262929        ]      }    }  ] }

Wikidata query
 { "type": "ExternalData", "service": "geoshape", "query": "SELECT ?id ?head (SAMPLE(?img) as ?img_) (min(?partyId) as ?party) (if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill) (concat(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf  .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel" }

Map data from Commons
 { "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" }

Mixed types
<mapframe text="Caderousse city wall" width="300" height="300" zoom="15" longitude="4.75600" latitude="44.10200"> [ {    "type": "ExternalData", "service": "geoshape", "ids": "Q13518258", "properties": { "stroke": "#ffb100", "stroke-width": 6, } },  {    "type": "Feature", "geometry": { "type": "Point", "coordinates": [4.75566, 44.104498] }, "properties": { "title": "Porte de Castellan" } },  {    "type": "Feature", "geometry": { "type": "Point", "coordinates": [4.75829, 44.10258] }, "properties": { "title": "Porte Léon Roche" } } ]

Mixed types with markers
<mapframe width="300" height="300" zoom="12" longitude="-73.965278" latitude="40.782222"> [ {    "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" }, {    "type": "ExternalData", "service": "geoshape", "ids": "Q160409", "properties": { "fill": "#07c63e", "title": "Central Park" } },  {    "type": "Feature", "properties": {"title": "Roosevelt Island", "marker-color": "f01080"}, "geometry": { "type": "Point", "coordinates": [ -73.94511222839355,       40.76734665426719      ]    }  } ]

Options de rendu
Le tableau suivant montre comment une carte peut être formatée pour être affichée sur une page wiki. Le tableau contient deux colonnes : la première montre une carte interactive via la balise et la seconde montre le rendu d'une image d'exemple avec les mêmes options.

Use the width value  in order to make the map take up the full width of the page. <mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478"> <mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478" frameless>

Styling
<mapframe text="Interstate Highway I-696" width="300" height="300" longitude="-83.2297" latitude="42.4883" zoom="9"> { "type": "ExternalData", "service": "geoline", "ids": "Q2108", "properties": { "title": "Highway I-696", "description": "", "stroke": "#ffb100", "stroke-width": 8 } }

Voir aussi

 * Help:VisualEditor/Maps - How to add and edit maps with the visual editor
 * Using Kartographer with OpenStreetMap
 * Maps project (2015-2017) - Documentation sur l'activité d'ingénierie Wikimedia de l'équipe Discovery de 2015 à 2017
 * Map improvements 2018 - Documentation sur l'activité d'ingénierie Wikimedia de l'équipe Collaboration en 2018
 * Guide du développeur de Kartographer
 * Conditions d'utilisation des cartes
 * Conditions d'utilisation des cartes