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.

196 lines
6.0 KiB

  1. type: overpass
  2. query:
  3. 11: way[railway~"^(rail|narrow_gauge|subway|light_rail)$"][usage~'^(main|branch)$'];
  4. 15: way[railway~"^(rail|narrow_gauge|funicular|monorail|narrow_gauge|subway|light_rail|tram|construction|proposed|abandoned|disused|razed)$"];
  5. feature:
  6. pre: |-
  7. {% set type = tags.railway %}
  8. {% set lifecyle = 'active' %}
  9. {% if tags.railway in ['abandoned', 'construction', 'proposed', 'disused', 'razed'] %}
  10. {% set lifecyle = tags.railway %}
  11. {% set type = attribute(tags, tags.railway)|default(attribute(tags, tags.railway ~ ':railway')) %}
  12. {% endif %}
  13. {% set color = const.types[type ~ '/' ~ tags.usage].color|default(const.types[type].color)|default(const.types.default.color) %}
  14. {% if tags.tunnel and tags.tunnel != 'no' %}
  15. {% set color = colorInterpolate([ color, '#ffffff' ], 0.3) %}
  16. {% endif %}
  17. {% set width = 2 %}
  18. {% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}
  19. {% set width = 1 %}
  20. {% elseif tags.railway in ['rail', 'narrow_gauge', 'abandoned', 'disused', 'razed'] %}
  21. {% if tags.usage in ['main', 'branch'] %}
  22. {% set width = 3 %}
  23. {% else %}
  24. {% set width = 2 %}
  25. {% endif %}
  26. {% endif %}
  27. title: |-
  28. {% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}
  29. {{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}
  30. {% if attribute(tags, 'tunnel:name') %}- {{ localizedTag(tags, 'tunnel:name') }}{% endif %}
  31. {% if attribute(tags, 'bridge:name') %}- {{ localizedTag(tags, 'bridge:name') }}{% endif %}
  32. description: |-
  33. {{ tagTrans('railway', type) }}
  34. {% if lifecyle != 'active' %}
  35. ({{ tagTrans('railway', lifecyle) }})
  36. {%- endif -%}
  37. {%- if tags.usage %}
  38. , {{ tagTrans('railway=rail usage', tags.usage) }}
  39. {% endif -%}
  40. {%- if tags.service %}
  41. , {{ tagTrans('railway=rail service', tags.service) }}
  42. {% endif -%}
  43. body: |-
  44. {% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}
  45. {% if tags.usage %}{{ keyTrans('railway=rail usage') }}: {{ tagTrans('railway=rail usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}
  46. {% if tags.service %}{{ keyTrans('railway=rail service') }}: {{ tagTrans('railway=rail service', tags.service ) }}<br/>{% endif %}
  47. {{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<br/>
  48. {% if tags.electrified == 'no' %}
  49. {{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}
  50. {% elseif tags.electrified %}
  51. {{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
  52. {% endif %}<br/>
  53. markerSign: |-
  54. {% if tags.railway in [ 'halt', 'tram_stop', 'station', 'stop', 'subway_entrance' ] %}X
  55. {% endif %}
  56. markerSymbol: false
  57. listMarkerSymbol: line
  58. styles: |-
  59. {% if tags.bridge and tags.bridge != 'no' %}casing_bridge,{% endif %}
  60. casing,casing_layer,
  61. {% if lifecyle != 'active' %}background,{% endif %}
  62. {% if tags.railway == 'narrow_gauge' %}default,narrow
  63. {% else %}default
  64. {% endif %}
  65. style:
  66. width: |-
  67. {{ width }}
  68. zIndex: |-
  69. {{ tags.layer|default(0) + 10 }}
  70. color: |-
  71. {{ color }}
  72. opacity: 1
  73. lineCap: |-
  74. {{ lifecyle == 'active' ? 'round' : 'butt' }}
  75. dashArray: |-
  76. {{ const.lifecyle[lifecyle].dashArray }}
  77. fill: false
  78. style:background:
  79. width: |-
  80. {{ width }}
  81. zIndex: |-
  82. {{ tags.layer|default(0) + 9.995 }}
  83. color: white
  84. opacity: 1
  85. fill: false
  86. style:casing:
  87. color: '#ffffff'
  88. pane: casing
  89. width: |-
  90. {{ width + 2 }}
  91. style:casing_layer:
  92. color: '#ffffff'
  93. zIndex: |-
  94. {{ tags.layer|default(0) + 9.99 }}
  95. width: |-
  96. {{ width + 2 }}
  97. lineCap: butt
  98. style:casing_bridge:
  99. color: '#000000'
  100. zIndex: |-
  101. {{ tags.layer|default(0) + 9.98 }}
  102. width: |-
  103. {{ width + 4 }}
  104. lineCap: butt
  105. style:narrow:
  106. width: |-
  107. {{ width + 2 }}
  108. color: |-
  109. {{ color }}
  110. lineCap: butt
  111. dashArray: '2,4'
  112. info: |-
  113. <table>
  114. {% for k, v in const.types %}
  115. {% if not v.hideInfo %}
  116. {% set railway_usage = k|split('/') %}
  117. {% if railway_usage|length == 2 %}
  118. <tr>
  119. <td>{{ markerLine(evaluate({ 'railway': railway_usage[0], 'usage': railway_usage[1] }))|raw }}</td>
  120. <td>{{ tagTrans('railway', railway_usage[0]) }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', railway_usage[1]) }}</td>
  121. </tr>
  122. {% else %}
  123. <tr>
  124. <td>{{ markerLine(evaluate({ "railway": k }))|raw }}</td>
  125. <td>{{ tagTrans('railway', k) }}</td>
  126. </tr>
  127. {% endif %}
  128. {% endif %}
  129. {% endfor %}
  130. <tr>
  131. <td>{{ markerLine(evaluate({ 'railway': 'rail', 'tunnel': 'yes'}))|raw }}</td>
  132. <td>{{ keyTrans('tunnel') }}</td>
  133. </tr>
  134. <tr>
  135. <td>{{ markerLine(evaluate({ 'railway': 'rail', 'bridge': 'yes'}))|raw }}</td>
  136. <td>{{ keyTrans('bridge') }}</td>
  137. </tr>
  138. {% for k, v in const.lifecyle %}
  139. {% if not v.hideInfo %}
  140. <tr>
  141. <td>{{ markerLine(evaluate({ 'railway': k, (k): 'rail'}))|raw }}</td>
  142. <td>{{ tagTrans('railway', k) }}</td>
  143. </tr>
  144. {% endif %}
  145. {% endfor %}
  146. </table>
  147. const:
  148. types:
  149. rail/main:
  150. color: '#ff8100'
  151. rail/branch:
  152. color: '#daca00'
  153. rail:
  154. color: '#000000'
  155. narrow_gauge:
  156. color: '#000000'
  157. subway:
  158. color: '#0000ff'
  159. tram:
  160. color: '#ff00ff'
  161. light_rail:
  162. color: '#ff007f'
  163. funicular:
  164. color: '#00BD14'
  165. monorail:
  166. color: '#007f00'
  167. default:
  168. color: '#ff0000'
  169. hideInfo: true
  170. lifecyle:
  171. active:
  172. dashArray: ''
  173. hideInfo: true
  174. proposed:
  175. dashArray: '5,5'
  176. construction:
  177. dashArray: '5,2'
  178. disused:
  179. dashArray: '2,5'
  180. abandoned:
  181. dashArray: '1,5'
  182. razed:
  183. dashArray: '1,9'