Extension:Kartographer

Kartographer is an experimental extension to add maps to wikis. It is very similar to Maps extension, but its functionality will be specifically targetting Wikimedia communities such as Wikivoyage and Wikipedia.

Demo
See vem3.wmflabs.org

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 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 point of interest (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.

&lt;mapframe> usage
This sample inserts a map of a given zoom and location (centered) and shows a museum icon. Depending on the client and network speed, the map could be shown as static or interactive. If static, the map can be clicked to show full screen and become interactive. If dynamic, the map should have a "maximize" icon to make it full screen. The content of the  tag has to be either empty or a valid GeoJSON with styling, as produced by GeoJSON editor. Map supports simplestyle specification with Maki icons (CC0).

&lt;maplink&gt; and auto-counters
creates a link that shows a full screen map when clicked. The link's text could be either set with the  attribute. Without the  attribute, the word "map" will be shown, unless in GeoJSON, the   is set to the magic   or   value. Each  will be replaced with an incremental counter , and   with   values. If GeoJSON has more than one counter, the value of the first one will be shown as the link's text. Optionally, editors may add a suffix to have multiple counters on the page at the same time. This way  will have different counter from. It would make sense to use a distinct color for each counting group. All data added via  will also be shown in all maps inserted with , unless   attribute is used.

Attributes:,  , and   control the location of the popup map. Use  for the link hint text. Use  for the text of the link (could be any valid wiki markup). Use  to add content of this tag to the named group (see below).

Groups
For WikiVoyage, we need to show a map whose data is defined somewhere else on the page. For example, there may be multiple points of interest (POI) defined with  tags, and one common map on the side that shows them all. The grouping concept allows editors to share data between multiple  and   tags.

By default, the data inside the  or   tag is shown only for that one tag, and will not be shown anywhere else. If  or   specify   attribute, the data inside those tags will be placed into a named group, together with all the other data by the same group name. As a result, any tags with the same group name will show the same map data, and each tag may incrementally add data to the group.

A tag may also show other groups, regardless if it itself belongs to a group or not, by specifying  attribute. Comma separated multiple group names may be specified. The group name may only contain lower case English letters. This matrix shows what data will be shown for each tag.