User talk:Moresby/Tag

From OpenStreetMap Wiki
Jump to navigation Jump to search

Existing {{Tag}} template usage analysis

Key and value analysis

Based on the 186,525 uses of the {{Tag}} template across this wiki on 2014-05-06, we can make the following observations:

  • 127,295 (68%) were a simple key and value, where that key had:
    • just one part on 120,310 occasions, such as {{Tag|waterway|waterfall}}
    • two parts on 5,456 occasions, such as {{Tag|generator:source|coal}}
    • three parts on 1,093 occasions, such as {{Tag|railway:signal:main|DE:hp}}
    • four parts on 402 occasions, such as {{Tag|animal_shelter:for:dog:boarding|yes}}
    • five parts on 29 occasions, such as {{Tag|parking:condition:both:free:time_interval|06:00-08:00}}
    • six parts on 5 occasions, such as {{Tag|traffic:hourly:01:We:fall:wet|150/15:00}}
  • 31,223 (17%) were a simple key, where that key had:
    • just one part on 25,252 occasions, such as {{Tag|name}}
    • two parts on 5,398 occasions, such as {{Tag|bridge:support}}
    • three parts on 504 occasions, such as {{Tag|authentication:membership_card:types}}
    • four parts on 68 occasions, such as {{Tag|climbing:grade:french:mean}}
    • five parts on 1 occasion: {{Tag|access:ship:cargo:tanker:singlehull}}
  • 24,638 (13%) were a simple key, and a non-linked value, with that value being:
    • yes on 4,552 occasions
    • no on 1,052 occasions
    • yes/no on 839 occasions
    • empty value on 359 occasions
    • 2 on 269 occasions
    • 1 on 221 occasions
    • ''yes/no'' on 211 occasions
  • 1,580 (0.8%) were a two-part key with a non-linked value, such as {{Tag|power_supply|:=maxcurrent||''value''}}
  • 618 (0.3%) were a sub-key with a non-linked value, such as {{tag|lanes|subkey=bus:forward||1}}
  • The remainder were other combinations of types of key and value.

This means that the three most basic forms (simple, one-part key with a simple value; simple, one-part key with no value, and simple key with a non-linked value) comprise 120,310 + 25,252 + 24,638 = 170200 occasions, approximately 91% of the total.

Language analysis

On 174,183 occasions (93%), no language codes are specified for linking.

Of the 12,331 occasions (7%) where a language was explicitly specified:

  • 9,561 (78%) applied a single language to each of the available parts, such as:
    • {{tag|amenity||fastfood|kl=de}},
    • {{Tag|railway|rail|kl=pl|vl=pl}}, or
    • {{Tag|cycleway|:=right|::=smoothness|excellent|kl=de|kl:=de|kl::=de|vl=de}},
  • 2,769 (22%) had one or more parts with a single specified language, and one or more parts with no language specified, such as:
    • {{Tag|building|cowshed|kl=pl}},
    • {{tag|emergency|vl=de|life_ring}}, or
    • {{Tag|diet|:=vegetarian|yes|kl=de}},
  • and only one had more than one different languages explicitly specified:
    • {{Tag|landuse|cemetery|kl=vl|vl=nl}}
    which is almost certainly an accidental error.

Incorrect parameter usage

In 1,189 cases, a combination of parameters was used which was not in line with the standard template usage. These cases include:

  • 435 cases where a second and third unnamed parameter was used, such as {{Tag|bicycle|:backward|yes}} or {{Tag|type|oil|gas|oil,gas}}, where the third (and succeeding) parts are quietly ignored.
  • 316 cases where a language was specified for a value which was not present, such as {{Tag|ele|kl=de|vl=de}} or {{Tag|boundary|vl=ES}}.
  • 268 cases where a language was specified for a value, but a non-linked value was requested, such as {{Tag|amenity||kindergarten|kl=ja|vl=ja}} or {{Tag|bicycle_road||yes|kl=de|vl=de}}.
  • 123 cases where extra parameters were specified, such as {{Tag|amenity|compressed_air||yes}}, {{Tag|landuse|railway|kl=pl|tl=pl}} or {{tag|man_made|workskl=nl}}

In some of these cases, these usages can be sensibly justified, and the template output will be what was intended. However, many of these indicate an accidental misuse of the template, or a confusion of understanding of how it should be used.

"Missing" links

In 17,490 cases (9%), a multipart key is specified as the "key" section of the template, such as {{Tag|seamark:type}}. The whole key name is linked to one page. Using the := functionality of the template, separate parts of the key could be linked to other pages, but this feature has not been used in these cases. While not strictly "missing", some of these cases may represent an opportunity to provide an additional useful page link, an opportunity which is not currently being realised.

Reimagining the {{Tag}} template

Ideally, the template used to format, display and link tags should be as easy to use as possible, in line with the relative ease of use of much wiki syntax. We could imagine something as simple as a tag value of highway=residential being represented as {{tag|highway=residential}} and producing something like:

highway=residential

where:

We could also extend this thought experiment to deal with more complex tagging, with something like {{tag|building:levels=2}} linking each of the key parts to an appropriate page:

   building : levels = 2
   --------   ------
      |          |
Key:building     |
                 |
          Key:building:levels

And even though multiple values are discouraged, on the occasions they are used, we can imagine them separately linked to appropriate pages, with something like {{tag|service=dealer;tyres;repair}} linking as shown:

 service = dealer;tyres;repair
 -------   ------ ----- ------
    |         |     |     |
Key:service   |     |     |
              |     |     +--- Tag:service=repair
              |     +--------- Tag:service=tyres
              +--------------- Tag:service=dealer