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.

410 lines
12 KiB

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