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.

473 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. {% else %}
  125. 0
  126. {% endif %}
  127. pattern: |
  128. {% if oneway -%}
  129. arrowHead
  130. {%- endif %}
  131. pattern-repeat: |
  132. 35
  133. pattern-offset: |
  134. {{ oneway == -1 ? 17 : 22 }}
  135. noClip: |
  136. {{ oneway != 0 }}
  137. pattern-polygon: true
  138. pattern-pixelSize: 9
  139. pattern-angleCorrection: |
  140. {{ oneway == -1 ? 180 : 0 }}
  141. pattern-path-color: |
  142. {{ const.types[type].color }}
  143. pattern-path-width: 0
  144. pattern-path-fillOpacity: 1
  145. zIndex: |-
  146. {{ tags.layer|default(0) }}
  147. style:footway:
  148. color: |
  149. {{ const.types.footway.color }}
  150. width: |
  151. {% if tags.segregated == 'yes' %}
  152. {{ const.types.footway.width / 2 }}
  153. {% else %}
  154. {{ const.types.footway.width }}
  155. {% endif %}
  156. dashArray: |
  157. {% if oneway and tags.segregated == 'no' %}
  158. 5,5,5,5,5,10
  159. {% elseif oneway %}
  160. 25,10
  161. {% elseif tags.segregated == 'no' %}
  162. 5,5
  163. {% endif %}
  164. dashOffset: |
  165. {% if oneway %}
  166. 10
  167. {% elseif tags.segregated == 'no' %}
  168. 5
  169. {% endif %}
  170. noClip: |
  171. {{ oneway != 0 }}
  172. lineCap: |
  173. {% if tags.segregated == 'no' or oneway %}
  174. butt
  175. {% else %}
  176. round
  177. {% endif %}
  178. offset: |
  179. {% if tags.segregated == 'yes' %}
  180. {{ (const.types.footway.width / 2 - 1) * -1 }}
  181. {% endif %}
  182. zIndex: |-
  183. {{ tags.layer|default(0) }}
  184. style:left:
  185. offset: -5
  186. color: |
  187. {{ const.types[leftCycle].color|default('#ff0000') }}
  188. width: 3
  189. lineCap: |
  190. {{ leftOneway ? 'butt' : 'round' }}
  191. dashArray: |
  192. {{ leftOneway ? '27,8' : '' }}
  193. dashOffset: |
  194. {{ leftOneway == -1 ? 28 : 0 }}
  195. noClip: true
  196. # {{ leftOneway }}
  197. pattern: |
  198. {% if leftOneway %}arrowHead{% endif %}
  199. pattern-offset: |
  200. {{ leftOneway == -1 ? 4 : 30.5 }}
  201. pattern-lineOffset: -5
  202. pattern-repeat: 35
  203. pattern-polygon: true
  204. pattern-pixelSize: 9
  205. pattern-angleCorrection: |
  206. {{ leftOneway == -1 ? 180 : 0 }}
  207. pattern-path-width: 0
  208. pattern-path-color: |
  209. {{ const.types[leftCycle].color|default('#ff0000') }}
  210. pattern-path-fillOpacity: 1
  211. zIndex: |-
  212. {{ tags.layer|default(0) }}
  213. style:right:
  214. offset: 5
  215. color: |
  216. {{ const.types[rightCycle].color|default('#ff0000') }}
  217. width: 3
  218. lineCap: |
  219. {{ rightOneway ? 'butt' : 'round' }}
  220. dashArray: |
  221. {{ rightOneway ? '27,8' : '' }}
  222. dashOffset: |
  223. {{ rightOneway == -1 ? 28 : 0 }}
  224. noClip: true
  225. # {{ rightOneway }}
  226. pattern: |
  227. {% if rightOneway %}arrowHead{% endif %}
  228. pattern-offset: |
  229. {{ rightOneway == -1 ? 4 : 30.5 }}
  230. pattern-lineOffset: 5
  231. pattern-repeat: 35
  232. pattern-polygon: true
  233. pattern-pixelSize: 9
  234. pattern-angleCorrection: |
  235. {{ rightOneway == -1 ? 180 : 0 }}
  236. pattern-path-width: 0
  237. pattern-path-color: |
  238. {{ const.types[rightCycle].color|default('#ff0000') }}
  239. pattern-path-fillOpacity: 1
  240. zIndex: |-
  241. {{ tags.layer|default(0) }}
  242. style:other:
  243. width: |
  244. {{ const.types[type].width + const.otherInfrastructure[tags.cycleway].extraWidth }}
  245. color: |
  246. {{ const.otherInfrastructure[tags.cycleway].color }}
  247. lineCap: |
  248. {{ const.otherInfrastructure[tags.cycleway].lineCap|default('round') }}
  249. dashArray: |
  250. {{ const.otherInfrastructure[tags.cycleway].dashArray|default('') }}
  251. offset: 0
  252. zIndex: |-
  253. {{ tags.layer|default(0) - 0.1 }}
  254. style:bridge:
  255. width: |
  256. {{ const.types[type].width|default(5) + 4 }}
  257. color: black
  258. lineCap: butt
  259. zIndex: |-
  260. {{ tags.layer|default(0) - 0.2 }}
  261. description: |
  262. {% if tags.cyclestreet == 'yes' %}
  263. {{ keyTrans('cyclestreet') }}
  264. {% elseif tags.bicycle_road in ['yes', 'designated'] %}
  265. {{ keyTrans('bicycle_road') }}
  266. {% elseif tags.segregated %}
  267. {{ tagTrans('highway', 'cycleway segregated=' ~ tags.segregated) }}
  268. {% elseif tags.highway %}
  269. {{ tagTrans('highway', tags.highway) }}
  270. {% endif %}
  271. body: |
  272. <ul>
  273. {% if const.otherInfrastructure[tags.cycleway] %}
  274. <li>
  275. {{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', tags.cycleway) }}
  276. </li>
  277. {% elseif tags.cycleway %}
  278. <li>
  279. {{ keyTrans('cycleway') }}:
  280. <div class='warning'>Recommendation: Indicate side of way by using 'cycleway:left' and/or 'cycleway:right'.</div>
  281. <ul>
  282. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', tags.cycleway) }}</li>
  283. </ul>
  284. </li>
  285. {% endif %}
  286. {% if tags.highway in ['cycleway'] or attribute(tags, 'cycleway:width') %}
  287. <li>
  288. {{ keyTrans('cycleway:width') }}:
  289. {% if not attribute(tags, 'cycleway:width') %}
  290. {{ trans('unknown') }}
  291. {% elseif attribute(tags, 'cycleway:width') matches "/(m|')$/" %}
  292. {{ attribute(tags, 'cycleway:width') }}
  293. {% else %}
  294. {{ attribute(tags, 'cycleway:width') }}m
  295. {% endif %}
  296. </li>
  297. {% endif %}
  298. {% if leftCycle %}
  299. <li>{{ keyTrans('cycleway:left') }}:
  300. {% if const.types[leftCycle].warning %}
  301. <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>
  302. {% elseif not const.types[leftCycle] %}
  303. <div class='warning'>Invalid tag cycleway:left={{ attribute(tags, 'cycleway:left') }}.</div>
  304. {% endif %}
  305. <ul>
  306. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both'))) }}</li>
  307. <li>
  308. {{ keyTrans('cycleway:width') }}:
  309. {% if not leftWidth %}
  310. {{ trans('unknown') }}
  311. {% elseif attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) matches "/(m|')$/" %}
  312. {{ attribute(tags, 'cycleway:left:width')|default(attribute(tags, 'cycleway:both:width')) }}
  313. {% else %}
  314. {{ leftWidth }}m
  315. {% endif %}
  316. </li>
  317. </ul></li>
  318. {% elseif attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both')) %}
  319. <li>{{ keyTrans('cycleway:left') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:left')|default(attribute(tags, 'cycleway:both'))) }}</li>
  320. {% endif %}
  321. {% if rightCycle %}
  322. <li>{{ keyTrans('cycleway:right') }}:
  323. {% if const.types[rightCycle].warning %}
  324. <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>
  325. {% elseif not const.types[rightCycle] %}
  326. <div class='warning'>Invalid tag cycleway:right={{ attribute(tags, 'cycleway:right') }}.</div>
  327. <div class='warning'>Unknown</div>
  328. {% endif %}
  329. <ul>
  330. <li>{{ keyTrans('cycleway') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both'))) }}</li>
  331. <li>
  332. {{ keyTrans('cycleway:width') }}:
  333. {% if not rightWidth %}
  334. {{ trans('unknown') }}
  335. {% elseif attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) matches "/(m|')$/" %}
  336. {{ attribute(tags, 'cycleway:right:width')|default(attribute(tags, 'cycleway:both:width')) }}
  337. {% else %}
  338. {{ rightWidth }}m
  339. {% endif %}
  340. </li>
  341. </ul></li>
  342. {% elseif attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both')) %}
  343. <li>{{ keyTrans('cycleway:right') }}: {{ tagTrans('cycleway', attribute(tags, 'cycleway:right')|default(attribute(tags, 'cycleway:both'))) }}</li>
  344. {% endif %}
  345. </ul>
  346. markerSymbol: ''
  347. listMarkerSymbol: line
  348. info: |
  349. <table>
  350. <tr>
  351. <th>Symbol</th>
  352. <th></th>
  353. </tr>
  354. {% for k, v in const.types %}
  355. <tr>
  356. <td>
  357. {{ markerLine({ width: 4, color: v.color }) }}
  358. </td>
  359. <td>
  360. {{ k }}
  361. </td>
  362. </tr>
  363. {% endfor %}
  364. </table>
  365. const:
  366. types:
  367. cycleway:
  368. color: '#009f00'
  369. width: 4
  370. footway:
  371. color: '#ff9f00'
  372. width: 4
  373. cyclestreet:
  374. color: '#006f3f'
  375. width: 8
  376. bicycle_road:
  377. color: '#006f4f'
  378. width: 8
  379. lane:
  380. color: '#00df3f'
  381. track:
  382. color: '#009f00'
  383. shared:
  384. color: '#ff0000'
  385. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway=lane, cycleway:oneway=-1 instead.'
  386. shared_lane:
  387. color: '#003faf'
  388. share_busway:
  389. color: '#ff7f00'
  390. opposite:
  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_lane:
  394. color: '#ff0000'
  395. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=lane, cycleway:%other_driving_side%:oneway=-1 instead.'
  396. opposite_share_busway:
  397. color: '#ff0000'
  398. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=share_busway, cycleway:%other_driving_side%:oneway=-1 instead.'
  399. opposite_track:
  400. color: '#ff0000'
  401. warning: 'Deprecated tag! Use oneway:bicycle=no and cycleway:%other_driving_side%=track, cycleway:%other_driving_side%:oneway=-1 instead.'
  402. otherInfrastructure:
  403. crossing:
  404. extraWidth: 4
  405. lineCap: butt
  406. dashArray: '4,4'
  407. color: black
  408. hiddenTypes:
  409. 'no': true
  410. separate: true