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.

129 lines
3.9 KiB

  1. query:
  2. 16: |-
  3. (
  4. way[building];
  5. relation[building];
  6. )
  7. feature:
  8. pre: |-
  9. {% if tags.height is defined %}
  10. {% set approxHeight = tags.height %}
  11. {% set m = tags.height|matches('(.*)\s*(m|ft)$') %}
  12. {% if m and m[2] == 'm' %}{% set approxHeight = m[1] %}{% endif %}
  13. {% if m and m[2] == 'ft' %}{% set approxHeight = m[1] / 3.2808 %}{% endif %}
  14. {% elseif attribute(tags, 'building:levels') is defined %}
  15. {% set approxHeight = attribute(tags, 'building:levels') * 3.5 %}
  16. {% endif %}
  17. {% if approxHeight <= 50 %}
  18. {% set color = colorInterpolate(['green', 'red'], approxHeight / 50) %}
  19. {% elseif approxHeight %}
  20. {% set color = colorInterpolate(['red', 'yellow'], (approxHeight - 50) / 250) %}
  21. {% else %}
  22. {% set color = '#7f7f7f' %}
  23. {% endif %}
  24. description: |-
  25. {% if tags.building == 'yes' and tags.military %}
  26. {{ tagTrans('building', 'military') }}
  27. {% elseif tags.building == 'yes' %}
  28. {{ keyTrans('building') }}
  29. {% else %}
  30. {{ tagTransList('building', tags.building) }}
  31. {% endif %}
  32. {% if tags.building == 'construction' and tags.construction %}
  33. ({{ tagTransList('building', tags.construction) }})
  34. {% endif %}
  35. {% if tags.building in [ 'yes', 'military' ] and tags.military %}
  36. ({{ tagTransList('military', tags.military) }})
  37. {% endif %}
  38. details: |-
  39. {% if tags.height is defined %}
  40. {% if tags.height|matches('(m|ft)$') %}{{ tags.height -}}
  41. {% else %}{{ tags.height }}&nbsp;m
  42. {%- endif -%}
  43. {% endif -%}
  44. {%- if attribute(tags, 'building:levels') is defined -%}
  45. {%- if tags.height is defined %}, {% endif %}
  46. {{ attribute(tags, 'building:levels') }} {{ keyTrans('building:levels') }}
  47. {% endif %}
  48. markerSymbol: null
  49. listMarkerSymbol: |-
  50. {{ markerPolygon({"fillColor": color, "fillOpacity": 0.8, "width": 1, "color": "#000000" })|raw }}
  51. markerSign: |-
  52. {% if map.zoom >= 18 %}
  53. <span style="color: white; font-size: 80%; line-height: 80%;">
  54. {%- if attribute(tags, 'building:levels') is defined -%}
  55. {{ attribute(tags, 'building:levels') }}
  56. <br>
  57. {% endif %}
  58. {% if tags.height is defined %}
  59. {% if tags.height|matches('(m|ft)$') %}({{ tags.height -}})
  60. {% else %}({{ tags.height }}m)
  61. {%- endif -%}
  62. {% endif -%}
  63. </span>
  64. {% else %} {% endif %}
  65. listMarkerSign: ' '
  66. priority: |-
  67. {{ (approxHeight|default(0)) * -1 }}
  68. style:
  69. width: 1
  70. color: '#000000'
  71. fillColor: |-
  72. {{ color }}
  73. fillOpacity: 1
  74. info: |-
  75. <div style='display: inline-block'>
  76. {{ tagTrans('height') }}
  77. <table>
  78. <tr>
  79. <td>{{ markerPolygon(evaluate({ "building": "yes" }))|raw }}</td>
  80. <td colspan>{{ trans('unknown') }}</td>
  81. </tr>
  82. {% for i in range(0, 50, 10) %}
  83. <tr>
  84. <td>{{ markerPolygon(evaluate({ "building": "yes", "height": i }))|raw }}</td>
  85. <td>{{ i }}m</td>
  86. </tr>
  87. {% endfor %}
  88. {% for i in range(100, 250, 50) %}
  89. <tr>
  90. <td>{{ markerPolygon(evaluate({ "building": "yes", "height": i }))|raw }}</td>
  91. <td>{{ i }}m</td>
  92. </tr>
  93. {% endfor %}
  94. <tr>
  95. <td>{{ markerPolygon(evaluate({ "building": "yes", "height": "300" }))|raw }}</td>
  96. <td>≥300m</td>
  97. </tr>
  98. </table>
  99. </div>
  100. <div style='display: inline-block'>
  101. {{ tagTrans('building:levels') }}
  102. <table>
  103. <tr>
  104. <td>{{ markerPolygon(evaluate({ "building": "yes" }))|raw }}</td>
  105. <td colspan>{{ trans('unknown') }}</td>
  106. </tr>
  107. {% for i in range(0, 12, 3) %}
  108. <tr>
  109. <td>{{ markerPolygon(evaluate({ "building": "yes", "building:levels": i }))|raw }}</td>
  110. <td>{{ i }}</td>
  111. </tr>
  112. {% endfor %}
  113. {% for i in range(15, 84, 15) %}
  114. <tr>
  115. <td>{{ markerPolygon(evaluate({ "building": "yes", "building:levels": i }))|raw }}</td>
  116. <td>{{ i }}</td>
  117. </tr>
  118. {% endfor %}
  119. <tr>
  120. <td>{{ markerPolygon(evaluate({ "building": "yes", "building:levels": "85" }))|raw }}</td>
  121. <td>≥85</td>
  122. </tr>
  123. </table>
  124. </div>