{
    "type": "overpass",
    "name": {
        "en": "Buildings",
        "de": "Gebäude"
    },
    "query": {
        "16": [
            "(",
            "  way[building];",
            "  relation[building];",
            ")"
        ]
    },
    "feature": {
        "pre": [
            "{% if tags.start_date %}",
            "  {% set value = tags.start_date|osmParseDate %}",
            "  {% if value and value[0] and value[1] %}",
            "    {% set value = (value[1] - value[0]) / 2 + value[0] %}",
            "  {% elseif value and value[0] %}",
            "    {% set value = value[0] %}",
            "  {% elseif value and value[1] %}",
            "    {% set value = value[1] %}",
            "  {% else %}",
            "    {% set value = 'error' %}",
            "  {% endif %}",
            "",
            "  {% if value == 'error' %}",
            "    {% set color = '#ff0000' %}",
            "  {% elseif value < 1500 %}",
            "    {% set color = '#0000ff' %}",
            "  {% elseif value < 1900 %}",
            "    {% set color = colorInterpolate([ '#0000ff', '#ff00ff' ], (value - 1500.0) / 400) %}",
            "  {% elseif value < 2000 %}",
            "    {% set color = colorInterpolate([ '#ff00ff', '#ffff00' ], (value - 1900.0) / 100) %}",
            "  {% else %}",
            "    {% set color = colorInterpolate([ '#ffff00', '#00ff00' ], (value - 2000.0) / 50) %}",
            "  {% endif %}",
            "{% else %}",
            "{% set color = '#000000' %}",
            "{% endif %}"
        ],
        "description": [
            "{% if tags.start_date %}",
            "{{ tags.start_date }}",
            "{% endif %}"
        ],
        "markerSign": null,
        "listMarkerSymbol": "polygon",
        "priority": [
            "{% set p = 100 %}",
            "{% if tags.start_date %}{% set p = p - 20 %}{% endif %}",
            "{% 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": {
            "weight": "1",
            "color": "#000000",
            "fillColor": "{{ color }}",
            "fillOpacity": "0.8"
        }
    },
    "info": [
        "<table>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1400\" }))|raw }}</td>",
        "    <td>&lt;1500</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1500\" }))|raw }}</td>",
        "    <td>1500</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1600\" }))|raw }}</td>",
        "    <td>1600</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1700\" }))|raw }}</td>",
        "    <td>1700</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1800\" }))|raw }}</td>",
        "    <td>1800</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1900\" }))|raw }}</td>",
        "    <td>1900</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1950\" }))|raw }}</td>",
        "    <td>1950</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"2000\" }))|raw }}</td>",
        "    <td>2000</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"2020\" }))|raw }}</td>",
        "    <td>2020</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"xxx\" }))|raw }}</td>",
        "    <td>unparseable start_date</td>",
        "  </tr>",
        "  <tr>",
        "    <td>{{ markerPolygon(evaluate({ \"building\": \"yes\" }))|raw }}</td>",
        "    <td>no start_date</td>",
        "  </tr>",
        "</table>"
    ]
}