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.

165 lines
5.3 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. {% if const.types[tags.railway] %}casing,casing_layer,{% endif %}
  61. {% if tags.railway in ['abandoned', 'disused', 'razed'] %}disused,{% 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. dashArray: |-
  74. {% if tags.railway == 'disused' %}1,5
  75. {% elseif tags.railway == 'abandoned' %}1,7
  76. {% elseif tags.railway == 'razed' %}1,9
  77. {% endif %}
  78. fill: false
  79. style:disused:
  80. width: |-
  81. {{ width }}
  82. zIndex: |-
  83. {{ tags.layer|default(0) + 9.995 }}
  84. color: white
  85. opacity: 1
  86. fill: false
  87. style:casing:
  88. color: '#ffffff'
  89. pane: casing
  90. width: |-
  91. {{ width + 2 }}
  92. style:casing_layer:
  93. color: '#ffffff'
  94. zIndex: |-
  95. {{ tags.layer|default(0) + 9.99 }}
  96. width: |-
  97. {{ width + 2 }}
  98. lineCap: butt
  99. style:casing_bridge:
  100. color: '#000000'
  101. zIndex: |-
  102. {{ tags.layer|default(0) + 9.98 }}
  103. width: |-
  104. {{ width + 4 }}
  105. lineCap: butt
  106. style:narrow:
  107. width: |-
  108. {{ width + 2 }}
  109. color: |-
  110. {{ color }}
  111. lineCap: butt
  112. dashArray: '2,4'
  113. info: |-
  114. <table>
  115. {% for k, v in const.types %}
  116. {% if not v.hideInfo %}
  117. {% set railway_usage = k|split('/') %}
  118. {% if railway_usage|length == 2 %}
  119. <tr>
  120. <td>{{ markerLine(evaluate({ 'railway': railway_usage[0], 'usage': railway_usage[1] }))|raw }}</td>
  121. <td>{{ tagTrans('railway', railway_usage[0]) }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', railway_usage[1]) }}</td>
  122. </tr>
  123. {% else %}
  124. <tr>
  125. <td>{{ markerLine(evaluate({ "railway": k }))|raw }}</td>
  126. <td>{{ tagTrans('railway', k) }}</td>
  127. </tr>
  128. {% endif %}
  129. {% endif %}
  130. {% endfor %}
  131. </table>
  132. const:
  133. types:
  134. rail/main:
  135. color: '#ff8100'
  136. rail/branch:
  137. color: '#daca00'
  138. rail:
  139. color: '#000000'
  140. narrow_gauge:
  141. color: '#000000'
  142. subway:
  143. color: '#0000ff'
  144. tram:
  145. color: '#ff00ff'
  146. light_rail:
  147. color: '#ff007f'
  148. funicular:
  149. color: '#00BD14'
  150. monorail:
  151. color: '#007f00'
  152. default:
  153. color: '#ff0000'
  154. hideInfo: true