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.

370 lines
10 KiB

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