Template:Mapshapes

From Wikivoyage
Jump to: navigation, search
[view] [edit] [history] [purge] Template-info.svg Template documentation


Documentation[edit]

This template overlays a group of shapes on a dynamic map using Template:Mapshape. Currently only geolines are supported.

The specified wikidata entry's sub-parts are iterated and each added as new Mapshape - with the right color applied. Primarily from statement P465/sRGB color hex triplet, fallback to P462/color, or template's default-color parameter.

Note that when the color property is modified in wikidata, it takes a few moments to reflect on wikivoyage.

Parameters[edit]

  • (Mandatory) First argument is Wikidata ID of the 'parent' item. From this, sub-mapshapes are gathered via the P527/"has part" property - with a fallback to P2670/"has parts of the class".
  • (Optional) Up to 9 Wikidata IDs can be specified - only those will be shown. If no ID is specified, all child items are shown.
  • stroke-width: (Optional) Overrides the default Mapshape stroke-width.
  • stroke-opacity: (Optional) Overrides the default Mapshape stroke-opacity.
  • default-color: (Optional) If no color information is available for a particular Mapshape in wikidata, this color is used. If unspecified, black (#000000) is used.

Example[edit]

Map metro lines in Wien using default values:

{{Mapframe|48.209|16.366|zoom=11}}
{{Mapshapes|Q209400}}

To only show one line:

{{Mapframe|49.4700|10.9907|zoom=11}}
{{Mapshapes|Q697512|Q3433210}}

Wikidata/OSM requirements to allow showing (public-)transport lines[edit]

The entry point of showing a mapshape is having a proper structure of the wikidata and OSM data. Basically, this is what we want to end up with:

  • Root wikidata entry of the transport system should contain links to its lines in has parts (P527) statements. Example: Q190271.
  • Each of the referenced lines contains (e.g. Q1292805):
    • color (P462) and/or sRGB color hex triplet (P465), the latter has preference. Optionally, P462 can have P465 specified as a qualifier (see e.g. Q168571#P462).
    • OSM relation ID (P402) referring to the data in OSM.
  • Finally, the OSM data referred by wikidata has the link back to wikidata, using the wikidata= (e.g. 7772996) tag.

If this is all done, this template will create Mapshape for each of the lines referenced by the root wikidata entry (using the right color). There's a (common) special case, see Template:Mapshape/doc#OSM wikidata tags.

Tutorial[edit]

Editing wikidata is easy enough, but OSM may get a bit intimidating for novice users. Please take your time to get used to it and don't destroy the database :)

This tutorial will show what has to be done to setup a transport system almost from scratch - in this case for Nuremberg. It expects that the data is already in place - i.e. that the wikidata for the transport system+individual lines exist, and that the OSM data already contain at least the relations for the transport lines. This is quite common, and it means that only the links need to be added to put it all together.

In the end, it's a detective work, but quite repeating in most cases.

  1. Find the wikidata entry for the metro. Quickest way seems to be - google "$city metro wiki" to find the wikipedia article. Sometimes also direct search on wikidata.org works :) ----> w:Nuremberg_U-Bahn. The corresponding wikidata item can be found on the left part of wikipedia, in "Tools"/Wikidata item ----> Q697512.
  2. If the has parts statement contains links to the transport lines, skip to next step. Otherwise, you'll have to find the lines (and create has parts statement, if there's nothing). Usually the easiest way is to go back to the wikipedia article and find some line list there. E.g. w:Nuremberg_U-Bahn#Network. From each of the wikipedia line articles (w:U1_(Nuremberg_U-Bahn), again gather the wikidata entry (Q3433210). Afterwards, get back to the main wikidata article, and add the lines into 'has part' statement, one by one.

    Wikidata-adding-has-part.png

  3. Find/fix the wikidata-OSM links acc. to Template:Mapshape#Editing tutorial

If the OSM stuff was missing, wait for a few days until the changes to reflected on wikivoyage. Otherwise the changes should reflect after cache purge (easiest way - add ?action=purge to url; or do empty edit - just hit "Publish changes' button without any changes).

See also[edit]

  • {{Mapshape}} - Template used to add a the individual mapshapes.