Main categories of OpenStreetBrowser with support for whitewater
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.

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