query:
  16: nwr[building][building!=no];
feature:
  pre: |-
    {% set type = tags.building|split(';')[0] %}
    {% if tags.military %}{% set type = 'military' %}{% endif %}
    {% set color = const.other.color %}
    {% for cat, data in const %}
      {% if type in data.types %}
        {% set color = data.color %}
      {% endif %}
    {% endfor %}
  description: |-
    {% if tags.building == 'yes' and tags.military %}
    {{ tagTrans('building', 'military') }}
    {% elseif tags.building == 'yes' %}
    {{ keyTrans('building') }}
    {% else %}
    {{ tagTransList('building', tags.building) }}
    {% endif %}
    {% if tags.building == 'construction' and tags.construction %}
    ({{ tagTransList('building', tags.construction) }})
    {% endif %}
    {% if tags.building in  [ 'yes', 'military' ] and tags.military %}
    ({{ tagTransList('military', tags.military) }})
    {% endif %}
  markerSymbol: ''
  listMarkerSymbol: |-
    {{ markerPolygon({"fillColor": color, "fillOpacity": 0.8, "width": 1, "color": "#000000" })|raw }}
  priority: |-
    {% set p = 100 %}
    {% if tags.name %}{% set p = p - 10 %}{% endif %}
    {% if tags.amenity %}{% set p = p - 1 %}{% endif %}
    {% if tags.historic %}{% set p = p - 1 %}{% endif %}
    {% if tags.culture %}{% set p = p - 1 %}{% endif %}
    {% if tags.highway %}{% set p = p - 1 %}{% endif %}
    {% if tags.railway %}{% set p = p - 1 %}{% endif %}
    {% if tags.aeroway %}{% set p = p - 1 %}{% endif %}
    {% if tags.amenity %}{% set p = p - 1 %}{% endif %}
    {% if tags.tourism %}{% set p = p - 1 %}{% endif %}
    {{ p }}
  style:
    width: 1
    color: '#000000'
    fillColor: |-
      {{ color }}
    fillOpacity: 0.8
info: |-
  <table>
  {% for cat, data in const %}
    <tr>
      <td valign='top'>{{ markerPolygon({ "fillColor": data.color, "fillOpacity": "0.8", "width": 1, "color": "#000000" })|raw }}</td>
      <td onclick='this.classList.toggle("infoShowDetails")'><b>{{ trans(data.name) }}</b><span class='details'>:
        {% for i, type in data.types %}<span title='building={{ type }}'>{% if i > 0 %}, {% endif %}{{ tagTrans('building', type) }}</span>{% endfor %}
        </span>
  <span class='summary'><i class="fa fa-info-circle" aria-hidden="true"></i></span>
      </td>
    </tr>
  {% endfor %}
  </table>
const:
  residential:
    name: tag:building=residential
    color: '#25a000'
    types:
      - house
      - apartments
      - block
      - flats
      - farm
      - detached
      - dormitory
      - terrace
      - houseboat
      - bungalow
      - static_caravan
      - residential
      - semidetached_house
      - ger
      - trullo
  tourism:
    name: tag:tourism
    color: '#814ce2'
    types:
      - hotel
      - ruins
      - conservatory
  commercial:
    name: tag:building=commercial
    color: '#ec5bcf'
    types:
      - commercial
      - office
      - industrial
      - retail
      - supermarket
      - warehouse
      - kiosk
      - mall
      - shop
  religious:
    name: tag:building=religious
    color: '#af29cc'
    types:
      - religious
      - cathedral
      - chapel
      - church
      - mosque
      - temple
      - synagogue
      - shrine
      - monastery
  amenity:
    name: tag:amenity
    color: '#2935cc'
    types:
      - kindergarten
      - civic
      - government
      - hospital
      - school
      - university
      - grandstand
      - public
      - toilets
      - college
  agriculture:
    name: tag:building=agriculture
    color: '#92e934'
    types:
      - bakehouse
      - barn
      - cowshed
      - farm_auxiliary
      - greenhouse
      - stable
      - sty
      - kitchen
      - slurry_tank
      - silo
  industrial:
    name: tag:landuse=industrial
    color: '#e2da1b'
    types:
      - construction
      - garbage_shed
      - transformer_tower
      - service
      - water_tower
      - industrial
      - warehouse
      - storage_tank
  transportation:
    name: tag:building=transportation
    color: '#1bb5e2'
    types:
      - carport
      - garage
      - garages
      - bridge
      - hangar
      - parking
      - train_station
      - transportation
  sport:
    name: tag:sport
    color: '#e21b66'
    types:
      - pavilion
      - riding_hall
      - stadium
      - sports_hall
  roof:
    name: tag:building=roof
    color: '#afafaf7f'
    types:
      - roof
  shelter:
    name: tag:amenity=shelter
    color: '#cc8725'
    types:
      - cabin
      - hut
      - shed
  military:
    name: tag:building=military
    color: '#4a7300'
    types:
      - bunker
      - military
  unspecified:
    name: tag:building=generic
    color: '#7f7f7f'
    types:
      - 'yes'
      - generic
  other:
    name: other
    color: '#ff0000'
    types: []