<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"
  author="achadwick"
  description="United Kingdom addresses"
  shortdescription="UK Addresses"
  icon="stamp1-16.svg"
  version="1.11_2025-08-06"
>

  <chunk id="premises">
    <optional text="Premises">
      <!-- Sub-building name -->
      <text key="addr:unit"
        text="Single Unit (&quot;Flat 1&quot;, &quot;Unit B&quot;, &quot;17&quot;)"
        match="key"
      />
      <text key="addr:flats"
        text="Multiple Units (e.g. &quot;3-7;10;14;16-18&quot;)"
        match="key"
      />
      <!-- Building name/number -->
      <text key="addr:housename"
        text="Building Name"
        match="key"
      />
      <text key="addr:housenumber"
        auto_increment="-2,-1,+1,+2"
        text="Building Number"
        match="key"
      />
    </optional>
  </chunk>

  <chunk id="thoroughfare-place">
    <optional text="Thoroughfare. Valid combinations: A, B, A+C, B+C, &lt;none&gt;">
      <!--
      For this schema, A+B is globally forbidden.
      That's fine though. We have addr:parentstreet when A is needed.
      -->
      <text key="addr:place"
        use_last_as_default="true"
        text="A: non-Street grouping"
        match="key"
      />
      <text key="addr:street"
        use_last_as_default="true"
        text="B: Street (actual or child)"
        match="key"
      />
      <text key="addr:parentstreet"
        use_last_as_default="true"
        text="C: Street (parent, if required)"
        match="key"
      />
    </optional>
  </chunk>

  <chunk id="thoroughfare-substreet">
    <optional text="Thoroughfare ('substreet' schema). Combinations: A, B, A+B, B+C, &lt;none&gt;">
      <!--
      For this schema, A+C is counterproductive: you *should* use street if permitted
      -->
      <text key="addr:substreet"
        use_last_as_default="true"
        text="A: non-Street grouping"
        match="key"
      />
      <text key="addr:street"
        use_last_as_default="true"
        text="B: Street (actual)"
        match="key"
      />
      <text key="addr:parentstreet"
        use_last_as_default="true"
        text="C: Street (parent, if required)"
        match="key"
      />
    </optional>
  </chunk>

  <chunk id="locality">
    <optional
      text="Locality. Subareas include hamlets/villages/towns/suburbs. One intermediate max."
    >
      <text key="addr:suburb"
        use_last_as_default="true"
        text="Optional: Subarea (of Post Town)"
        match="key"
      />
      <text key="addr:hamlet"
        use_last_as_default="true"
        text="Rare: Intermediate (if hamlet)"
        match="key"/>
      <text key="addr:village"
        use_last_as_default="true"
        text="Rare: Intermediate (if village)"
        match="key"
      />
      <text key="addr:town"
        use_last_as_default="true"
        text="Rare: Intermediate (if town)"
        match="key"
      />
      <text key="addr:city"
        use_last_as_default="true"
        text="Required: Post Town (or city)"
        match="key"
      />
      <space />
      <text key="addr:postcode"
        use_last_as_default="true"
        text="Postcode"
        match="key"
      />
    </optional>
  </chunk>

  <group name="Annotation">

    <!-- UK address -->
    <item name="UK Address: approved worldwide schema"
      preset_name_label="true"
      icon="stamp1-16.svg"
      type="node,way,closedway,multipolygon"
      match_expression='"addr:"*=* -("addr:substreet"=*)'
    >
      <link href="https://wiki.openstreetmap.org/wiki/Addresses_in_the_United_Kingdom"/>
      <reference ref="premises"/>
      <reference ref="thoroughfare-place"/>
      <reference ref="locality"/>
    </item>

    <item name="UK Address: accepted regional schema"
      preset_name_label="true"
      icon="stamp1-16.svg"
      type="node,way,closedway,multipolygon"
      match_expression='"addr:substreet"=* -("addr:place"=*)'
    >
      <link href="https://wiki.openstreetmap.org/wiki/Addresses_in_the_United_Kingdom"/>
      <reference ref="premises"/>
      <reference ref="thoroughfare-substreet"/>
      <reference ref="locality"/>
    </item>

    <!-- Addresses with tags and combinations that are deprecated in the UK -->

    <item
      name="UK Address: deprecated place+substreet combination"
      preset_name_label="true"
      icon="stamp3-16.svg"
      type="node,way,closedway,multipolygon"
      match_expression='"addr:substreet"=* AND "addr:place"=*'
    >
      <label text="addr:place must not be used together with addr:substreet: their meanings overlap."/>
      <label text="Both of these tags are used when addresses are grouped by something other than a street." />
      <label text="To fix this problem, use only one of the schemas below."/>

      <reference ref="thoroughfare-place"/>
      <space/>
      <item_separator />
      <reference ref="thoroughfare-substreet"/>
      <space/>
    </item>

    <item
      name="UK Address: deprecated place+street combination"
      preset_name_label="true"
      icon="stamp3-16.svg"
      type="node,way,closedway,multipolygon"
      match_expression='"addr:place"=* AND "addr:street"=*'
    >
      <label text="addr:place cannot be used together with addr:street. Their meanings overlap."/>
      <label text="The addr:place tag is used when addresses are grouped by something other than a street." />

      <reference ref="thoroughfare-place"/>
      <space/>

      <label text="You may have meant to use a Locality tag instead." />

      <reference ref="locality"/>
      <space/>

    </item>


    <!-- And a grab-bag of tags to avoid -->

    <item
      name="UK Address: tags to avoid"
      preset_name_label="true"
      icon="stamp2-16.svg"
      type="node,way,closedway,multipolygon"
    >
      <link href="https://wiki.openstreetmap.org/wiki/Addresses_in_the_United_Kingdom#Tags_to_avoid"/>

      <optional text="Avoid: too vague, or they duplicate approved tags">
        <text key="addr:terrace"
          text="Terrace [1]"
          match="key"
        />
        <text
          key="addr:locality"
          text="Locality [2]"
          match="key"
        />
        <text
          key="addr:site"
          text="Site [1]"
          match="key"
        />
      </optional>

      <optional text="Avoid: the UK doesn't have these administrative area types">
        <text key="addr:subdistrict"
          text="Sub-district [2]"
          match="key"
        />
        <text key="addr:province"
          text="Province"
          match="key"
        />
        <text key="addr:state"
          text="State"
          match="key"
        />
      </optional>

      <optional text="Not needed: OSM admin boundaries are sufficient">
        <text key="addr:district"
          text="Local Authority"
          match="key"
        />
        <text key="addr:county"
          text="County"
          match="key"
        />
        <text key="addr:country"
          text="Country"
          match="key"
        />
      </optional>

      <!--
        Make it easier to replace deprecated tags with accepted ones
        by putting the most common accepted alternatives here.
      -->

      <optional text="Hint: consider replacing [1]s and [2]s above with…">

        <text key="addr:place"
          use_last_as_default="true"
          text="[1] Non-Street grouping"
          match="none"
        />

        <text key="addr:suburb"
          use_last_as_default="true"
          text="[2] Subarea of Post Town"
          match="none"
        />

        <space />

        <preset_link
          preset_name="UK Address"
          text="Or use one of the accepted tags from the full list:"
        />
      </optional>

    </item>

  </group>
</presets>
