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.

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