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.

405 lines
12 KiB

  1. query:
  2. (
  3. way[highway=cycleway];
  4. way[cyclestreet=yes];
  5. way[bicycle_road=yes];
  6. way["cycleway"]["cycleway"!~"(no|separate)"];
  7. way["cycleway:left"]["cycleway:left"!~"(no|separate)"];
  8. way["cycleway:right"]["cycleway:right"!~"(no|separate)"];
  9. way["cycleway:both"]["cycleway:both"!~"(no|separate)"];
  10. )
  11. feature:
  12. pre: |
  13. {% set type = tags.highway %}
  14. {% if tags.cyclestreet == 'yes' %}
  15. {% set type = 'cyclestreet' %}
  16. {% elseif tags.bicycle_road in ['yes', 'designated'] %}
  17. {% set type = 'bicycle_road' %}
  18. {% endif %}
  19. {% set oneway = attribute(tags, 'oneway:bicycle')|default(tags.oneway) %}
  20. {% if oneway == 'yes' %}
  21. {% set oneway = 1 %}
  22. {% elseif oneway == 'no' %}
  23. {% set oneway = 0 %}
  24. {% endif %}
  25. {% set leftCycle = '' %}{% set rightCycle = '' %}
  26. {% if tags.cycleway %}
  27. {% if (tags.oneway in ['yes', 1] and map.driving_side == 'right') or (tags.oneway in [-1] and map.driving_side == 'left') %}
  28. {{ tags.cycleway|debug }}
  29. {% if tags.cycleway matches '/^opposite/' %}
  30. {% set leftCycle = tags.cycleway %}
  31. {% else %}
  32. {% set rightCycle = tags.cycleway %}
  33. {% endif %}
  34. {% elseif (tags.oneway in ['yes', 1] and map.driving_side == 'left') or (tags.oneway in [-1] and map.driving_side == 'right') %}
  35. {% if tags.cycleway matches '/^opposite/' %}
  36. {% set rightCycle = tags.cycleway %}
  37. {% else %}
  38. {% set leftCycle = tags.cycleway %}
  39. {% endif %}
  40. {% else %}
  41. {% set leftCycle = tags.cycleway %}
  42. {% set rightCycle = tags.cycleway %}
  43. {% endif %}
  44. {% endif %}
  45. {% set leftCycle1 = attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both')) %}
  46. {% if leftCycle1 %}{% set leftCycle = leftCycle1 %}{% endif %}
  47. {% if leftCycle in ['no', 'separate'] %}
  48. {% set leftCycle = '' %}
  49. {% endif %}
  50. {% set leftOneway = attribute(tags, 'cycleway:left:oneway')|default(attribute(tags, 'cycleway:both:oneway')) %}
  51. {% if not leftOneway or leftOneway in ['yes'] %}
  52. {% set leftOneway = map.driving_side == 'left' ? 1 : -1 %}
  53. {% elseif leftOneway in ['no'] %}
  54. {% set leftOneway = 0 %}
  55. {% endif %}
  56. {% set rightCycle1 = attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both')) %}
  57. {% if rightCycle1 %}{% set rightCycle = rightCycle1 %}{% endif %}
  58. {% if rightCycle in ['no', 'separate'] %}
  59. {% set rightCycle = '' %}
  60. {% endif %}
  61. {% set rightOneway = attribute(tags, 'cycleway:right:oneway')|default(attribute(tags, 'cycleway:both:oneway')) %}
  62. {% if not rightOneway or rightOneway in ['yes'] %}
  63. {% set rightOneway = map.driving_side == 'left' ? -1 : 1 %}
  64. {% elseif rightOneway in ['no'] %}
  65. {% set rightOneway = 0 %}
  66. {% endif %}
  67. styles: |
  68. {% if tags.segregated %}
  69. footway,
  70. {% endif %}
  71. default
  72. {% if leftCycle %}
  73. ,left
  74. {% endif %}
  75. {% if rightCycle %}
  76. ,right
  77. {% endif %}
  78. style:
  79. width: |
  80. {% if tags.segregated == 'yes' %}
  81. {{ const.types[type].width / 2 }}
  82. {% else %}
  83. {{ const.types[type].width }}
  84. {% endif %}
  85. dashArray: |
  86. {% if oneway and tags.segregated == 'no' %}
  87. 5,5,5,20
  88. {% elseif oneway %}
  89. 25,10
  90. {% elseif tags.segregated == 'no' %}
  91. 5,5
  92. {% endif %}
  93. dashOffset: |
  94. {% if oneway and tags.segregated == 'no' %}
  95. 5
  96. {% elseif oneway %}
  97. 10
  98. {% elseif tags.segregated == 'no' %}
  99. 0
  100. {% endif %}
  101. lineCap: |
  102. {% if tags.segregated == 'no' or oneway %}
  103. butt
  104. {% else %}
  105. round
  106. {% endif %}
  107. color: |
  108. {{ const.types[type].color }}
  109. offset: |
  110. {% if tags.segregated == 'yes' %}
  111. {{ const.types[type].width / 2 - 1 }}
  112. {% endif %}
  113. pattern: |
  114. {% if oneway -%}
  115. arrowHead
  116. {%- endif %}
  117. pattern-repeat: |
  118. 35
  119. pattern-offset: |
  120. {{ oneway == -1 ? 17 : 22 }}
  121. noClip: |
  122. {{ oneway != 0 }}
  123. pattern-polygon: true
  124. pattern-pixelSize: 9
  125. pattern-angleCorrection: |
  126. {{ oneway == -1 ? 180 : 0 }}
  127. pattern-path-color: |
  128. {{ const.types[type].color }}
  129. pattern-path-width: 0
  130. pattern-path-fillOpacity: 1
  131. style:footway:
  132. color: |
  133. {{ const.types.footway.color }}
  134. width: |
  135. {% if tags.segregated == 'yes' %}
  136. {{ const.types.footway.width / 2 }}
  137. {% else %}
  138. {{ const.types.footway.width }}
  139. {% endif %}
  140. dashArray: |
  141. {% if oneway and tags.segregated == 'no' %}
  142. 5,5,5,5,5,10
  143. {% elseif oneway %}
  144. 25,10
  145. {% elseif tags.segregated == 'no' %}
  146. 5,5
  147. {% endif %}
  148. dashOffset: |
  149. {% if oneway %}
  150. 10
  151. {% elseif tags.segregated == 'no' %}
  152. 5
  153. {% endif %}
  154. noClip: |
  155. {{ oneway != 0 }}
  156. lineCap: |
  157. {% if tags.segregated == 'no' or oneway %}
  158. butt
  159. {% else %}
  160. round
  161. {% endif %}
  162. offset: |
  163. {% if tags.segregated == 'yes' %}
  164. {{ (const.types.footway.width / 2 - 1) * -1 }}
  165. {% endif %}
  166. style:left:
  167. offset: -5
  168. color: |
  169. {{ const.types[leftCycle].color|default('#ff0000') }}
  170. width: 3
  171. lineCap: |
  172. {{ leftOneway ? 'butt' : 'round' }}
  173. dashArray: |
  174. {{ leftOneway ? '27,8' : '' }}
  175. dashOffset: |
  176. {{ leftOneway == -1 ? 28 : 0 }}
  177. noClip: true
  178. # {{ leftOneway }}
  179. pattern: |
  180. {% if leftOneway %}arrowHead{% endif %}
  181. pattern-offset: |
  182. {{ leftOneway == -1 ? 4 : 30.5 }}
  183. pattern-lineOffset: -5
  184. pattern-repeat: 35
  185. pattern-polygon: true
  186. pattern-pixelSize: 9
  187. pattern-angleCorrection: |
  188. {{ leftOneway == -1 ? 180 : 0 }}
  189. pattern-path-width: 0
  190. pattern-path-color: |
  191. {{ const.types[leftCycle].color|default('#ff0000') }}
  192. pattern-path-fillOpacity: 1
  193. style:right:
  194. offset: 5
  195. color: |
  196. {{ const.types[rightCycle].color|default('#ff0000') }}
  197. width: 3
  198. lineCap: |
  199. {{ rightOneway ? 'butt' : 'round' }}
  200. dashArray: |
  201. {{ rightOneway ? '27,8' : '' }}
  202. dashOffset: |
  203. {{ rightOneway == -1 ? 28 : 0 }}
  204. noClip: true
  205. # {{ rightOneway }}
  206. pattern: |
  207. {% if rightOneway %}arrowHead{% endif %}
  208. pattern-offset: |
  209. {{ rightOneway == -1 ? 4 : 30.5 }}
  210. pattern-lineOffset: 5
  211. pattern-repeat: 35
  212. pattern-polygon: true
  213. pattern-pixelSize: 9
  214. pattern-angleCorrection: |
  215. {{ rightOneway == -1 ? 180 : 0 }}
  216. pattern-path-width: 0
  217. pattern-path-color: |
  218. {{ const.types[rightCycle].color|default('#ff0000') }}
  219. pattern-path-fillOpacity: 1
  220. description: |
  221. {% if tags.cyclestreet == 'yes' %}
  222. {{ keyTrans('cyclestreet') }}
  223. {% elseif tags.bicycle_road in ['yes', 'designated'] %}
  224. {{ keyTrans('bicycle_road') }}
  225. {% elseif tags.segregated %}
  226. {{ tagTrans('highway', 'cycleway segregated=' ~ tags.segregated) }}
  227. {% elseif tags.highway %}
  228. {{ tagTrans('highway', tags.highway) }}
  229. {% endif %}
  230. body: |
  231. <ul>
  232. {% if tags.cycleway %}
  233. <li>
  234. {{ keyTrans('cycleway') }}:
  235. <div class='warning'>Recommendation: Indicate side of way by using 'cycleway:left' and/or 'cycleway:right'.</div>
  236. <ul>
  237. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', tags.cycleway) }}</li>
  238. </ul>
  239. </li>
  240. {% endif %}
  241. {% if tags.highway in ['cycleway'] or attribute(tags, 'cycleway:width') %}
  242. <li>
  243. {{ keyTrans('cycleway:width') }}:
  244. {% if not attribute(tags, 'cycleway:width') %}
  245. {{ trans('unknown') }}
  246. {% elseif attribute(tags, 'cycleway:width') matches "/(m|')$/" %}
  247. {{ attribute(tags, 'cycleway:width') }}
  248. {% else %}
  249. {{ attribute(tags, 'cycleway:width') }}m
  250. {% endif %}
  251. </li>
  252. {% endif %}
  253. {% if attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both')) %}
  254. <li>{{ keyTrans('cycleway:left') }}:
  255. {% if const.types[leftCycle].warning %}
  256. <div class='warning'>{{ const.types[leftCycle].warning|replace({'%driving_side%': map.driving_side, '%other_driving_side%': map.driving_side == 'right' ? 'left': 'right', '%current%': 'left'}) }}</div>
  257. {% elseif not const.types[leftCycle] %}
  258. <div class='warning'>Invalid tag cycleway:left={{ attribute(tags, 'cycleway:left') }}.</div>
  259. {% endif %}
  260. <ul>
  261. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both'))) }}</li>
  262. <li>
  263. {{ keyTrans('cycleway:width') }}:
  264. {% if not leftWidth %}
  265. {{ trans('unknown') }}
  266. {% elseif attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) matches "/(m|')$/" %}
  267. {{ attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) }}
  268. {% else %}
  269. {{ leftWidth }}m
  270. {% endif %}
  271. </li>
  272. </ul></li>
  273. {% endif %}
  274. {% if attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both')) %}
  275. <li>{{ keyTrans('cycleway:right') }}:
  276. {% if const.types[rightCycle].warning %}
  277. <div class='warning'>{{ const.types[rightCycle].warning|replace({'%driving_side%': map.driving_side, '%other_driving_side%': map.driving_side == 'right' ? 'left': 'right', '%current%': 'right'}) }}</div>
  278. {% elseif not const.types[rightCycle] %}
  279. <div class='warning'>Invalid tag cycleway:right={{ attribute(tags, 'cycleway:right') }}.</div>
  280. <div class='warning'>Unknown</div>
  281. {% endif %}
  282. <ul>
  283. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both'))) }}</li>
  284. <li>
  285. {{ keyTrans('cycleway:width') }}:
  286. {% if not rightWidth %}
  287. {{ trans('unknown') }}
  288. {% elseif attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) matches "/(m|')$/" %}
  289. {{ attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) }}
  290. {% else %}
  291. {{ rightWidth }}m
  292. {% endif %}
  293. </li>
  294. </ul></li>
  295. {% endif %}
  296. </ul>
  297. markerSymbol: ''
  298. listMarkerSymbol: line
  299. info: |
  300. <table>
  301. <tr>
  302. <th>Symbol</th>
  303. <th></th>
  304. </tr>
  305. {% for k, v in const.types %}
  306. <tr>
  307. <td>
  308. {{ markerLine({ width: 4, color: v.color }) }}
  309. </td>
  310. <td>
  311. {{ k }}
  312. </td>
  313. </tr>
  314. {% endfor %}
  315. </table>
  316. const:
  317. types:
  318. cycleway:
  319. color: '#009f00'
  320. width: 4
  321. footway:
  322. color: '#ff9f00'
  323. width: 4
  324. cyclestreet:
  325. color: '#006f3f'
  326. width: 8
  327. bicycle_road:
  328. color: '#006f4f'
  329. width: 8
  330. lane:
  331. color: '#00df3f'
  332. track:
  333. color: '#009f00'
  334. shared:
  335. color: '#ff0000'
  336. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway=lane, cycleway:oneway=-1 instead.'
  337. shared_lane:
  338. color: '#003faf'
  339. share_busway:
  340. color: '#ff7f00'
  341. opposite:
  342. color: '#ff0000'
  343. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=lane, cycleway:%other_driving_side%:oneway=-1 instead.'
  344. opposite_lane:
  345. color: '#ff0000'
  346. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=lane, cycleway:%other_driving_side%:oneway=-1 instead.'
  347. opposite_share_busway:
  348. color: '#ff0000'
  349. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=share_busway, cycleway:%other_driving_side%:oneway=-1 instead.'
  350. opposite_track:
  351. color: '#ff0000'
  352. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=track, cycleway:%other_driving_side%:oneway=-1 instead.'