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.

165 lines
7.6 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. "body": [
  87. "<ul>",
  88. "{% if attribute(tags, 'building:start_date') %}<li>",
  89. "<span class='key'>{{ keyTrans('building:start_date') }}:</span>",
  90. "<span class='value'>{{ attribute(tags, 'building:start_date')|osmFormatDate }}</span>",
  91. "</li>{% endif %}",
  92. "</ul>"
  93. ],
  94. "markerSymbol": null,
  95. "listMarkerSymbol": "{{ markerPolygon({ \"fillColor\": color, \"fillOpacity\": 0.8, \"width\": 1, \"color\": \"#000000\" })|raw }}",
  96. "priority": [
  97. "{% set p = 100 %}",
  98. "{% if start_date %}{% set p = p - 20 %}{% endif %}",
  99. "{% if tags.name %}{% set p = p - 10 %}{% endif %}",
  100. "{% if tags.amenity %}{% set p = p - 1 %}{% endif %}",
  101. "{% if tags.historic %}{% set p = p - 1 %}{% endif %}",
  102. "{% if tags.culture %}{% set p = p - 1 %}{% endif %}",
  103. "{% if tags.highway %}{% set p = p - 1 %}{% endif %}",
  104. "{% if tags.railway %}{% set p = p - 1 %}{% endif %}",
  105. "{% if tags.aeroway %}{% set p = p - 1 %}{% endif %}",
  106. "{% if tags.amenity %}{% set p = p - 1 %}{% endif %}",
  107. "{% if tags.tourism %}{% set p = p - 1 %}{% endif %}",
  108. "{{ p }}"
  109. ],
  110. "style": {
  111. "width": "1",
  112. "color": "#000000",
  113. "fillColor": "{{ color }}",
  114. "fillOpacity": "0.8"
  115. }
  116. },
  117. "info": [
  118. "<table>",
  119. " <tr>",
  120. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1400\" }))|raw }}</td>",
  121. " <td>&lt;1500</td>",
  122. " </tr>",
  123. " <tr>",
  124. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1500\" }))|raw }}</td>",
  125. " <td>1500</td>",
  126. " </tr>",
  127. " <tr>",
  128. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1600\" }))|raw }}</td>",
  129. " <td>1600</td>",
  130. " </tr>",
  131. " <tr>",
  132. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1700\" }))|raw }}</td>",
  133. " <td>1700</td>",
  134. " </tr>",
  135. " <tr>",
  136. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1800\" }))|raw }}</td>",
  137. " <td>1800</td>",
  138. " </tr>",
  139. " <tr>",
  140. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1900\" }))|raw }}</td>",
  141. " <td>1900</td>",
  142. " </tr>",
  143. " <tr>",
  144. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"1950\" }))|raw }}</td>",
  145. " <td>1950</td>",
  146. " </tr>",
  147. " <tr>",
  148. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"2000\" }))|raw }}</td>",
  149. " <td>2000</td>",
  150. " </tr>",
  151. " <tr>",
  152. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"2020\" }))|raw }}</td>",
  153. " <td>2020</td>",
  154. " </tr>",
  155. " <tr>",
  156. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\", \"start_date\": \"xxx\" }))|raw }}</td>",
  157. " <td>{{ repoTrans('date format not understood') }}</td>",
  158. " </tr>",
  159. " <tr>",
  160. " <td>{{ markerPolygon(evaluate({ \"building\": \"yes\" }))|raw }}</td>",
  161. " <td>{{ trans('unknown') }}</td>",
  162. " </tr>",
  163. "</table>"
  164. ]
  165. }