Main categories of OpenStreetBrowser
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.

147 lines
5.8 KiB

  1. query:
  2. 16: |-
  3. (
  4. way[building];
  5. relation[building];
  6. )
  7. feature:
  8. pre: |-
  9. {% set type = tags.building|split(';')[0] %}
  10. {% if tags.military %}{% set type = 'military' %}{% endif %}
  11. {% set start_date = tags.start_date %}
  12. {% if attribute(tags, 'building:start_date') %}{% set start_date = attribute(tags, 'building:start_date') %}{% endif %}
  13. {# Deprecated tags #}
  14. {% if not start_date and attribute(tags, 'building:age') %}{% set start_date = attribute(tags, 'building:age') %}{% endif %}
  15. {% if not start_date and attribute(tags, 'building:year_built') %}{% set start_date = attribute(tags, 'building:year_built') %}{% endif %}
  16. {% if not start_date and attribute(tags, 'building:buildyear') %}{% set start_date = attribute(tags, 'building:buildyear') %}{% endif %}
  17. {% if not start_date and attribute(tags, 'year_built') %}{% set start_date = attribute(tags, 'year_built') %}{% endif %}
  18. {% if not start_date and attribute(tags, 'building:year') %}{% set start_date = attribute(tags, 'building:year') %}{% endif %}
  19. {% if not start_date and attribute(tags, 'year_of_construction') %}{% set start_date = attribute(tags, 'year_of_construction') %}{% endif %}
  20. {% if start_date %}
  21. {# equalize tagging mistakes - need to add QA messages #}
  22. {# 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 %}
  23. {# convert 191* to 1910s #}{% set m = start_date|matches('^(\d{3})\*$') %}{% if m %}{% set start_date = m[1] ~ '0s' %}{% endif %}
  24. {% set value = start_date|osmParseDate %}
  25. {% if value and value[0] and value[1] %}
  26. {% set value = (value[1] - value[0]) / 2 + value[0] %}
  27. {% elseif value and value[0] %}
  28. {% set value = value[0] %}
  29. {% elseif value and value[1] %}
  30. {% set value = value[1] %}
  31. {% else %}
  32. {% set value = 'error' %}
  33. {% endif %}
  34. {% if value == 'error' %}
  35. {% set color = '#ff0000' %}
  36. {% elseif value < 1500 %}
  37. {% set color = '#0000ff' %}
  38. {% elseif value < 1900 %}
  39. {% set color = colorInterpolate([ '#0000ff', '#ff00ff' ], (value - 1500.0) / 400) %}
  40. {% elseif value < 2000 %}
  41. {% set color = colorInterpolate([ '#ff00ff', '#ffff00' ], (value - 1900.0) / 100) %}
  42. {% else %}
  43. {% set color = colorInterpolate([ '#ffff00', '#00ff00' ], (value - 2000.0) / 50) %}
  44. {% endif %}
  45. {% else %}
  46. {% set color = '#7f7f7f' %}
  47. {% endif %}
  48. description: |-
  49. {% if tags.building == 'yes' and tags.military %}
  50. {{ tagTrans('building', 'military') }}
  51. {% elseif tags.building == 'yes' %}
  52. {{ keyTrans('building') }}
  53. {% else %}
  54. {{ tagTransList('building', tags.building) }}
  55. {% endif %}
  56. {% if tags.building == 'construction' and tags.construction %}
  57. ({{ tagTransList('building', tags.construction) }})
  58. {% endif %}
  59. {% if tags.building in [ 'yes', 'military' ] and tags.military %}
  60. ({{ tagTransList('military', tags.military) }})
  61. {% endif %}
  62. details: |-
  63. {% if start_date %}
  64. {{ start_date|osmFormatDate({ format: 'short' }) }}
  65. {% else %}
  66. {{ trans('unknown') }}
  67. {% endif %}
  68. body: |-
  69. <ul>
  70. {% if attribute(tags, 'building:start_date') %}<li>
  71. <span class='key'>{{ keyTrans('building:start_date') }}:</span>
  72. <span class='value'>{{ attribute(tags, 'building:start_date')|osmFormatDate }}</span>
  73. </li>{% endif %}
  74. </ul>
  75. markerSymbol: null
  76. listMarkerSymbol: |-
  77. {{ markerPolygon({ "fillColor": color, "fillOpacity": 0.8, "width": 1, "color": "#000000" })|raw }}
  78. priority: |-
  79. {% set p = 100 %}
  80. {% if start_date %}{% set p = p - 20 %}{% endif %}
  81. {% if tags.name %}{% set p = p - 10 %}{% endif %}
  82. {% if tags.amenity %}{% set p = p - 1 %}{% endif %}
  83. {% if tags.historic %}{% set p = p - 1 %}{% endif %}
  84. {% if tags.culture %}{% set p = p - 1 %}{% endif %}
  85. {% if tags.highway %}{% set p = p - 1 %}{% endif %}
  86. {% if tags.railway %}{% set p = p - 1 %}{% endif %}
  87. {% if tags.aeroway %}{% set p = p - 1 %}{% endif %}
  88. {% if tags.amenity %}{% set p = p - 1 %}{% endif %}
  89. {% if tags.tourism %}{% set p = p - 1 %}{% endif %}
  90. {{ p }}
  91. style:
  92. width: 1
  93. color: '#000000'
  94. fillColor: '{{ color }}'
  95. fillOpacity: 0.8
  96. info: |-
  97. <table>
  98. <tr>
  99. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1400" }))|raw }}</td>
  100. <td>&lt;1500</td>
  101. </tr>
  102. <tr>
  103. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1500" }))|raw }}</td>
  104. <td>1500</td>
  105. </tr>
  106. <tr>
  107. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1600" }))|raw }}</td>
  108. <td>1600</td>
  109. </tr>
  110. <tr>
  111. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1700" }))|raw }}</td>
  112. <td>1700</td>
  113. </tr>
  114. <tr>
  115. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1800" }))|raw }}</td>
  116. <td>1800</td>
  117. </tr>
  118. <tr>
  119. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1900" }))|raw }}</td>
  120. <td>1900</td>
  121. </tr>
  122. <tr>
  123. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "1950" }))|raw }}</td>
  124. <td>1950</td>
  125. </tr>
  126. <tr>
  127. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "2000" }))|raw }}</td>
  128. <td>2000</td>
  129. </tr>
  130. <tr>
  131. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "2020" }))|raw }}</td>
  132. <td>2020</td>
  133. </tr>
  134. <tr>
  135. <td>{{ markerPolygon(evaluate({ "building": "yes", "start_date": "xxx" }))|raw }}</td>
  136. <td>{{ repoTrans('date format not understood') }}</td>
  137. </tr>
  138. <tr>
  139. <td>{{ markerPolygon(evaluate({ "building": "yes" }))|raw }}</td>
  140. <td>{{ trans('unknown') }}</td>
  141. </tr>
  142. </table>