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.

Goals

 * A simple method to insert a map into an article without requiring common.js code changes
 * Ability to overlay the map from the tile server (Kartotherian) with extra information (marks, area, popups, text, links)
 * Ability to generate static images on the server with all the extrta layers (faster loading, allows to print)
 * Ability to incrementally add features to the map. For example, each usage of the restaurant template in WikiVoyage adds a single POI, but the map shows all of them.
 * Multiple items added` independently 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.
 * Ability to gather map usage statistics (KPI) to better gauge how and what should be improved.

Simple Static Map
This inserts a default static image of a map that does not allow any user interactions. The map is rendered on the server and will be very fast to load. All above parameters are mandatory.

Simple Dynamic Map
Same map as the static example above, but here the map allows interactions - zooming and moving around.

Click to Interact and Other Modes

 * Show the map as a static image at first, but upon clicking, it will become interactive. This allows much faster initial map loading, and saves on bandwidth and power until user actually wants to browse the map.
 * Same as, but it will also expand the map to use all available window space, similar to what happens on image click.
 * TBD. Show a link instead of a map. Clicking the link shows a map as a full screen popup window.

Adding Custom Data
The content of the  tag has to be either empty or a valid JSON, in a format similar to Leaflet. The content of the tag may also contain any template expansions, such as or. This should not cause any problems because the " {{ " is an impossible construct in JSON.

TBD: Evaluate security implications - leaflet was built with the assumption of the full trust to the developer

Combining Data (for Wikivoyage & Lists)
Wikivoyage tends to have a large number of items (musemus, restaurants, etc) listed on a page. Each item is usually entered as a template. It would be useful to have all these items appear on the same map. To help with that, Kartographer tag has a  mode. All features of all  tags will be combined together, in the order appearing on the page, and inserted instead of the   feature (possibly more than once). Optionally we could introduce a grouping concept - if there is more than one list on the page, and they should not be shown together on the same map, we could specify  attribute on the data tag, and a   key in the feature. Lastly, we could even introduce cross-page by specifying  value to point to the data on another page.

Counting Dilemma
TBD: When multiple data items are shown on the same map, they have to be identifable, e.g. with an index. The parser functions and Lua will not support any stateful parsing, which means we cannot have each mode=data template expansion know which index it belongs to. This is similar to how Cite indexing works. We need a similar mechanism to be able to count within an article.