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.

266 lines
9.0 KiB

  1. query: |
  2. (
  3. way[highway=cycleway];
  4. way[highway=path][bicycle][bicycle!=no];
  5. way["cycleway:width"];
  6. way["cycleway:left"]["cycleway:left"!~"(no|separate)"];
  7. way["cycleway:right"]["cycleway:right"!~"(no|separate)"];
  8. way["cycleway:both"]["cycleway:both"!~"(no|separate)"];
  9. )
  10. feature:
  11. pre: |
  12. {% set driving_side = 'right' %}
  13. {% set type = tags.highway %}
  14. {% if tags.highway == 'path' and tags.bicycle and tags.bicycle != 'no' %}
  15. {% set type = 'cycleway' %}
  16. {% endif %}
  17. {% set width = attribute(tags, 'cycleway:width')|default(tags.width) %}
  18. {% if width matches "/'$/" %}
  19. {% set width = (width|slice(0, -1)) * 0.3048 %}
  20. {% endif %}
  21. {% set leftCycle = attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both')) %}
  22. {% if leftCycle in ['no', 'separate'] %}
  23. {% set leftCycle = '' %}
  24. {% endif %}
  25. {% set leftOneway = attribute(tags, 'cycleway:left:oneway')|default(attribute(tags, 'cycleway:both:oneway')) %}
  26. {% if not leftOneway or leftOneway in ['yes'] %}
  27. {% set leftOneway = driving_side ? -1 : 1 %}
  28. {% elseif leftOneway in ['no'] %}
  29. {% set leftOneway = 0 %}
  30. {% endif %}
  31. {% set leftWidth = attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) %}
  32. {% if leftWidth matches "/'$/" %}
  33. {% set leftWidth = (leftWidth|slice(0, -1)) * 0.3048 %}
  34. {% endif %}
  35. {% set rightCycle = attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both')) %}
  36. {% if rightCycle in ['no', 'separate'] %}
  37. {% set rightCycle = '' %}
  38. {% endif %}
  39. {% set rightOneway = attribute(tags, 'cycleway:right:oneway')|default(attribute(tags, 'cycleway:both:oneway')) %}
  40. {% if not rightOneway or rightOneway in ['yes'] %}
  41. {% set rightOneway = driving_side ? 1 : -1 %}
  42. {% elseif rightOneway in ['no'] %}
  43. {% set rightOneway = 0 %}
  44. {% endif %}
  45. {% set rightWidth = attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) %}
  46. {% if rightWidth matches "/'$/" %}
  47. {% set rightWidth = (rightWidth|slice(0, -1)) * 0.3048 %}
  48. {% endif %}
  49. styles: default{% if leftCycle %},left{% endif %}{% if rightCycle %},right{% endif %}
  50. style:
  51. width: 4
  52. opacity: |
  53. {{ type == 'cycleway' or attribute(tags, 'cycleway:width') ? 1 : 0 }}
  54. color: |
  55. {% set minWidth = tags.oneway in ['yes', 1, -1] ? const.minWidthOneway : const.minWidthBoth %}
  56. {% set optWidth = tags.oneway in ['yes', 1, -1] ? const.optWidthOneway : const.optWidthBoth %}
  57. {% if width %}
  58. {{ colorInterpolate(const.colorScheme, (width - minWidth) / (optWidth - minWidth)) }}
  59. {% else %}{{ const.unknownColor }}
  60. {% endif %}
  61. lineCap: |
  62. {{ tags.oneway in ['yes', 1, -1] ? 'butt' : 'round' }}
  63. dashArray: |
  64. {{ tags.oneway in ['yes', 1, -1] ? '27,8' : '' }}
  65. dashOffset: |
  66. {{ tags.oneway in [-1] ? 28 : 0 }}
  67. noClip: |
  68. {{ tags.oneway in ['yes', 1, -1] }}
  69. pattern: |
  70. {% if type == 'cycleway' or attribute(tags, 'cycleway:width') %}
  71. {% if tags.oneway in ['yes', 1, -1] %}arrowHead{% endif %}
  72. {% endif %}
  73. pattern-offset: |
  74. {{ tags.oneway in [-1] ? 4 : 30.5 }}
  75. pattern-repeat: 35
  76. pattern-polygon: true
  77. pattern-pixelSize: 9
  78. pattern-angleCorrection: |
  79. {{ tags.oneway in [-1] ? 180 : 0 }}
  80. pattern-path-width: 0
  81. pattern-path-color: |
  82. {% if width %}
  83. {{ colorInterpolate(const.colorScheme, (width - minWidth) / (optWidth - minWidth)) }}
  84. {% else %}{{ const.unknownColor }}
  85. {% endif %}
  86. pattern-path-fillOpacity: 1
  87. style:left:
  88. offset: -5
  89. width: |
  90. {{ leftCycle in ['no', 'separate'] ? 0 : 3 }}
  91. color: |
  92. {% set minWidth = const.minWidthOneway %}
  93. {% set optWidth = const.optWidthOneway %}
  94. {% if leftWidth %}
  95. {{ colorInterpolate(const.colorScheme, (leftWidth - minWidth) / (optWidth - minWidth)) }}
  96. {% else %}{{ const.unknownColor }}
  97. {% endif %}
  98. lineCap: |
  99. {{ leftOneway ? 'butt' : 'round' }}
  100. dashArray: |
  101. {{ leftOneway ? '27,8' : '' }}
  102. dashOffset: |
  103. {{ leftOneway in [-1] ? 28 : 0 }}
  104. noClip: |
  105. {{ leftOneway }}
  106. pattern: |
  107. {% if leftOneway %}arrowHead{% endif %}
  108. pattern-offset: |
  109. {{ leftOneway == -1 ? 4 : 30.5 }}
  110. pattern-lineOffset: -5
  111. pattern-repeat: 35
  112. pattern-polygon: true
  113. pattern-pixelSize: 9
  114. pattern-angleCorrection: |
  115. {{ leftOneway == -1 ? 180 : 0 }}
  116. pattern-path-width: 0
  117. pattern-path-color: |
  118. {% if leftWidth %}
  119. {{ colorInterpolate(const.colorScheme, (leftWidth - minWidth) / (optWidth - minWidth)) }}
  120. {% else %}{{ const.unknownColor }}
  121. {% endif %}
  122. pattern-path-fillOpacity: 1
  123. style:right:
  124. offset: 5
  125. width: |
  126. {{ rightCycle in ['no', 'separate'] ? 0 : 3 }}
  127. color: |
  128. {% set minWidth = const.minWidthOneway %}
  129. {% set optWidth = const.optWidthOneway %}
  130. {% if rightWidth %}
  131. {{ colorInterpolate(const.colorScheme, (rightWidth - minWidth) / (optWidth - minWidth)) }}
  132. {% else %}{{ const.unknownColor }}
  133. {% endif %}
  134. lineCap: |
  135. {{ rightOneway ? 'butt' : 'round' }}
  136. dashArray: |
  137. {{ rightOneway ? '27,8' : '' }}
  138. dashOffset: |
  139. {{ rightOneway in [-1] ? 28 : 0 }}
  140. noClip: |
  141. {{ rightOneway }}
  142. pattern: |
  143. {% if rightOneway %}arrowHead{% endif %}
  144. pattern-offset: |
  145. {{ rightOneway == -1 ? 4 : 30.5 }}
  146. pattern-lineOffset: 5
  147. pattern-repeat: 35
  148. pattern-polygon: true
  149. pattern-pixelSize: 9
  150. pattern-angleCorrection: |
  151. {{ rightOneway == -1 ? 180 : 0 }}
  152. pattern-path-width: 0
  153. pattern-path-color: |
  154. {% if rightWidth %}
  155. {{ colorInterpolate(const.colorScheme, (rightWidth - minWidth) / (optWidth - minWidth)) }}
  156. {% else %}{{ const.unknownColor }}
  157. {% endif %}
  158. pattern-path-fillOpacity: 1
  159. markerSymbol: false
  160. listMarkerSymbol: line
  161. description: |
  162. {{ tagTrans('highway', type) }}
  163. details: |
  164. {% if not attribute(tags, 'cycleway:width') %}
  165. {% elseif attribute(tags, 'cycleway:width') matches "/'$/" %}
  166. {{ attribute(tags, 'cycleway:width') }}
  167. {% else %}
  168. {{ attribute(tags, 'cycleway:width') }}m
  169. {% endif %}
  170. body: |
  171. <ul>
  172. {% if type in ['cycleway'] or attribute(tags, 'cycleway:width') %}
  173. <li>
  174. {{ keyTrans('cycleway:width') }}:
  175. {% if not attribute(tags, 'cycleway:width') %}
  176. {{ trans('unknown') }}
  177. {% elseif attribute(tags, 'cycleway:width') matches "/(m|')$/" %}
  178. {{ attribute(tags, 'cycleway:width') }}
  179. {% else %}
  180. {{ attribute(tags, 'cycleway:width') }}m
  181. {% endif %}
  182. </li>
  183. {% endif %}
  184. {% if leftCycle %}
  185. <li>{{ keyTrans('cycleway:left') }}:<ul>
  186. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both'))) }}</li>
  187. <li>
  188. {{ keyTrans('cycleway:width') }}:
  189. {% if not leftWidth %}
  190. {{ trans('unknown') }}
  191. {% elseif attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) matches "/(m|')$/" %}
  192. {{ attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) }}
  193. {% else %}
  194. {{ leftWidth }}m
  195. {% endif %}
  196. </li>
  197. </ul></li>
  198. {% endif %}
  199. {% if rightCycle %}
  200. <li>{{ keyTrans('cycleway:right') }}:<ul>
  201. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both'))) }}</li>
  202. <li>
  203. {{ keyTrans('cycleway:width') }}:
  204. {% if not rightWidth %}
  205. {{ trans('unknown') }}
  206. {% elseif attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) matches "/(m|')$/" %}
  207. {{ attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) }}
  208. {% else %}
  209. {{ rightWidth }}m
  210. {% endif %}
  211. </li>
  212. </ul></li>
  213. {% endif %}
  214. </ul>
  215. info: |
  216. <table>
  217. <tr>
  218. <th>Symbol</th>
  219. <th>{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'yes') }}</th>
  220. <th>{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'no') }}</th>
  221. </tr>
  222. <tr>
  223. <td>
  224. {{ markerLine({ width: 4, color: const.unknownColor }) }}
  225. </td>
  226. <td>
  227. {{ trans('unknown') }}
  228. </td>
  229. <td>
  230. {{ trans('unknown') }}
  231. </td>
  232. </tr>
  233. {% for v in range(0, 1, 0.25) %}
  234. <tr>
  235. <td>
  236. {{ markerLine({ width: 4, color: colorInterpolate(const.colorScheme, v) }) }}
  237. </td>
  238. <td>
  239. {% if v == 0 %}<={% elseif v == 1 %}>={% endif %}
  240. {{ (const.minWidthOneway + (v * (const.optWidthOneway - const.minWidthOneway)))|number_format(2) }}m
  241. </td>
  242. <td>
  243. {% if v == 0 %}<={% elseif v == 1 %}>={% endif %}
  244. {{ (const.minWidthBoth + (v * (const.optWidthBoth - const.minWidthBoth)))|number_format(2) }}m
  245. </td>
  246. </tr>
  247. {% endfor %}
  248. </table>
  249. const:
  250. minWidthBoth: 1.5
  251. optWidthBoth: 5
  252. minWidthOneway: 0.75
  253. optWidthOneway: 3
  254. colorScheme: ['#ff0000', '#ff00ff', '#0000ff']
  255. unknownColor: black