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.

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