Template:Mapshapes

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


Documentation

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 on Wikidata, it takes a few moments to reflect on Wikivoyage.

Parameters

  • (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.
  • group: (Optional): Overrides the default Group (mask).

Example

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

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

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

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

Adds a group of geoshapes to interactive map. Currently only supports adding geolines.

[Edit template data]

Template parameters

ParameterDescriptionTypeStatus
Wikidata 11

First Wikidata QID parent item associated with Geoshape (only supports Geoline)

Example
Q12345
Stringrequired
Wikidata 22

Second Wikidata QID parent item associated with Geoshape (only supports Geoline)

Stringoptional
Wikidata 33

Third Wikidata QID parent item associated with Geoshape (only supports Geoline)

Stringoptional
Wikidata 44

Fourth Wikidata QID parent item associated with Geoshape (only supports Geoline)

Unknownoptional
Wikidata 55

Fifth Wikidata QID parent item associated with Geoshape (only supports Geoline)

Stringoptional
Wikidata 66

Sixth Wikidata QID parent item associated with Geoshape (only supports Geoline)

Unknownoptional
Wikidata 77

Seventh Wikidata QID parent item associated with Geoshape (only supports Geoline)

Stringoptional
Wikidata 88

Eighth Wikidata QID parent item associated with Geoshape (only supports Geoline)

Stringoptional
Wikidata 99

Ninth Wikidata QID parent item associated with Geoshape (only supports Geoline)

Stringoptional
Stroke Widthstroke-width

If entered, overrides the default stroke width

Numberoptional
Stroke Opacitystroke-opacity

If entered, overrides the default stroke opacity

Numberoptional
Default Colordefault-color

If wikidata related shape does not have a colour already assigned, the shape will be assigned the hex colour entered here. If not entered, shapes that do not already have colours will be assigned the colour #000000 (ie black)

Example
#F16BA1
Stringoptional
Overrides the default group maskgroup

no description

Stringoptional