You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
6.6 KiB
146 lines
6.6 KiB
{
|
|
"type": "overpass",
|
|
"name": {
|
|
"de": "Gebäudealter",
|
|
"en": "Building age",
|
|
"fr": "Date de construction",
|
|
"pt-br": "Idade"
|
|
},
|
|
"query": {
|
|
"16": [
|
|
"(",
|
|
" way[building];",
|
|
" relation[building];",
|
|
")"
|
|
]
|
|
},
|
|
"feature": {
|
|
"pre": [
|
|
"{% set start_date = tags.start_date %}",
|
|
"{% if attribute(tags, 'building:start_date') %}{% set start_date = attribute(tags, 'building:start_date') %}{% endif %}",
|
|
"{# Deprecated tags #}",
|
|
"{% if not start_date and attribute(tags, 'building:age') %}{% set start_date = attribute(tags, 'building:age') %}{% endif %}",
|
|
"{% if not start_date and attribute(tags, 'building:year_built') %}{% set start_date = attribute(tags, 'building:year_built') %}{% endif %}",
|
|
"{% if not start_date and attribute(tags, 'building:buildyear') %}{% set start_date = attribute(tags, 'building:buildyear') %}{% endif %}",
|
|
"{% if not start_date and attribute(tags, 'year_built') %}{% set start_date = attribute(tags, 'year_built') %}{% endif %}",
|
|
"{% if not start_date and attribute(tags, 'building:year') %}{% set start_date = attribute(tags, 'building:year') %}{% endif %}",
|
|
"{% if not start_date and attribute(tags, 'year_of_construction') %}{% set start_date = attribute(tags, 'year_of_construction') %}{% endif %}",
|
|
"",
|
|
"{% if start_date %}",
|
|
" {# equalize tagging mistakes - need to add QA messages #}",
|
|
" {# convert 1910-1911 to 1910..1911 #}{% set m = start_date|matches('^(\\d{4})-(\\d{4})$') %}{% if m %}{% set start_date = m[1] ~ '..' ~ m[2] %}{% endif %}",
|
|
" {# convert 191* to 1910s #}{% set m = start_date|matches('^(\\d{3})\\*$') %}{% if m %}{% set start_date = m[1] ~ '0s' %}{% endif %}",
|
|
"",
|
|
"",
|
|
" {% set value = 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 = '#7f7f7f' %}",
|
|
"{% endif %}"
|
|
],
|
|
"description": [
|
|
"{% if start_date %}",
|
|
"{{ start_date|osmFormatDate({ format: 'short' }) }}",
|
|
"{% else %}",
|
|
"{{ trans('unknown') }}",
|
|
"{% endif %}"
|
|
],
|
|
"popupDescription": [
|
|
"{% if start_date %}",
|
|
"{{ start_date|osmFormatDate }}",
|
|
"{% else %}",
|
|
"{{ trans('unknown') }}",
|
|
"{% endif %}"
|
|
],
|
|
"markerSymbol": null,
|
|
"listMarkerSymbol": "{{ markerPolygon({ \"fillColor\": color, \"fillOpacity\": 0.8, \"width\": 1, \"color\": \"#000000\" })|raw }}",
|
|
"priority": [
|
|
"{% set p = 100 %}",
|
|
"{% if 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": {
|
|
"width": "1",
|
|
"color": "#000000",
|
|
"fillColor": "{{ color }}",
|
|
"fillOpacity": "0.8"
|
|
}
|
|
},
|
|
"info": [
|
|
"<table>",
|
|
" <tr>",
|
|
" <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1400\" }))|raw }}</td>",
|
|
" <td><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>{{ repoTrans('date format not understood') }}</td>",
|
|
" </tr>",
|
|
" <tr>",
|
|
" <td>{{ markerPolygon(evaluate({ \"building\": \"yes\" }))|raw }}</td>",
|
|
" <td>{{ trans('unknown') }}</td>",
|
|
" </tr>",
|
|
"</table>"
|
|
]
|
|
}
|