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.

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