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.

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