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.

164 lines
7.4 KiB

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