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.

199 lines
8.9 KiB

7 years ago
  1. {
  2. "type": "overpass",
  3. "name": {
  4. "en": "Railway infrastructure",
  5. "de": "Eisenbahn Infrastruktur"
  6. },
  7. "query": {
  8. "11": "(way[railway=rail][usage~'^(main|branch)$'];node[railway~'^(station)$'];)",
  9. "14": "(way[railway];node[railway~'^(station|halt|tram_stop)$'];)",
  10. "18": "(node[railway];way[railway];)"
  11. },
  12. "feature": {
  13. "pre": [
  14. "{% set railway_type = null %}",
  15. "",
  16. "{% if tags.railway == 'disused' %}",
  17. " {% set railway_type = attribute(tags, 'disused:railway')|default(tags.disused) %}",
  18. "{% elseif tags.railway == 'abandoned' %}",
  19. " {% set railway_type = attribute(tags, 'abandoned:railway')|default(tags.abandoned) %}",
  20. "{% elseif tags.railway == 'proposed' %}",
  21. " {% set railway_type = attribute(tags, 'proposed:railway')|default(tags.proposed) %}",
  22. "{% elseif tags.railway in [ 'rail', 'narrow_gauge', 'subway', 'light_rail', 'tram' ] %}",
  23. " {% set railway_type = tags.railway %}",
  24. "{% endif %}"
  25. ],
  26. "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
  27. "description": "{{ tagTrans('railway', tags.railway) }}",
  28. "body": [
  29. "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}",
  30. "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}",
  31. "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}",
  32. "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<br/>",
  33. "{% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}<br/>{% endif %}",
  34. ""
  35. ],
  36. "markerSign": "{% if tags.railway in [ 'halt', 'tram_stop', 'station', 'stop', 'subway_entrance' ] %}H{% endif %}",
  37. "markerSymbol": [
  38. "{% if tags.railway == 'signal' %}",
  39. "<svg anchorX='5' anchorY='8' width='9' height='15'>",
  40. " <rect x='0.5' y='0.5' width='8' height='14' style='fill: #000000; fill-opacity: 1;' />",
  41. " <circle cx='4.5' cy='4.5' r='2.5' style='stroke-width: 1; stroke: #000000; fill: #7f7f7f;'/>",
  42. " <circle cx='4.5' cy='10.5' r='2.5' style='stroke-width: 1; stroke: #000000; fill: #ff0000;'/>",
  43. "</Xsvg>",
  44. "{% elseif tags.railway == 'switch' %}",
  45. "<svg anchorX='5' anchorY='8' width='9' height='15'>",
  46. " <rect x='0.5' y='0.5' width='8' height='14' style='fill: #ffffff; fill-opacity: 1;' />",
  47. " <line x1='2' x2='2' y1='2' y2='13' style='stroke-width: 2; stroke: #000000; stroke-linecap: round;'/>",
  48. " <line x1='2' x2='7' y1='10' y2='2' style='stroke-width: 2; stroke: #000000; stroke-linecap: round;'/>",
  49. "</svg>",
  50. "{% elseif tags.railway == 'railway_crossing' %}",
  51. "<svg anchorX='5' anchorY='8' width='9' height='15'>",
  52. " <rect x='0.5' y='0.5' width='8' height='14' style='fill: #ffffff; fill-opacity: 1;' />",
  53. " <line x1='2' x2='7' y1='2' y2='13' style='stroke-width: 2; stroke: #000000; stroke-linecap: round;'/>",
  54. " <line x1='7' x2='2' y1='2' y2='13' style='stroke-width: 2; stroke: #000000; stroke-linecap: round;'/>",
  55. "</svg>",
  56. "{% endif %}"
  57. ],
  58. "listMarkerSymbol": [
  59. "{% if tags.railway in [ 'station', 'halt', 'tram_stop', 'stop', 'subway_entrance', 'signal', 'switch', 'railway_crossing' ] %}",
  60. "{% else %}",
  61. "line",
  62. "{% endif %}"
  63. ],
  64. "priority": [
  65. "{% if tags.railway == 'station' %}0",
  66. "{% elseif tags.railway in [ 'halt' ] %}1",
  67. "{% elseif tags.railway in [ 'tram_stop', 'stop' ] %}2",
  68. "{% elseif tags.railway in [ 'subway_entrance' ] %}3",
  69. "{% else %}5",
  70. "{% endif %}"
  71. ],
  72. "styles": [
  73. "{% if railway_type %}",
  74. "highlight,default",
  75. "{% else %}",
  76. "default",
  77. "{% endif %}"
  78. ],
  79. "style": {
  80. "width": [
  81. "{% if tags.railway in [ 'platform' ] %}",
  82. "1",
  83. "{% elseif tags.railway in [ 'signal', 'switch', 'railway_crossing' ] %}",
  84. "0",
  85. "{% elseif tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}",
  86. "1",
  87. "{% elseif tags.usage == 'main' or tags.usage == 'branch' %}",
  88. " 3",
  89. "{% else %}",
  90. " 2",
  91. "{% endif %}"
  92. ],
  93. "color": "{{ const[railway_type].color }}",
  94. "opacity": "1",
  95. "lineCap": [
  96. "{% if tags.railway in [ 'disused', 'abandoned', 'proposed' ] %}",
  97. "butt",
  98. "{% else %}",
  99. "round",
  100. "{% endif %}"
  101. ],
  102. "dashArray": [
  103. "{% if tags.railway == 'disused' %}1,5",
  104. "{% elseif tags.railway == 'abandoned' %}1,7",
  105. "{% elseif tags.railway == 'proposed' %}2,2",
  106. "{% elseif tags.tunnel %}5,5",
  107. "{% endif %}"
  108. ],
  109. "fill": [
  110. "{% if tags.railway == 'platform' %}",
  111. "1",
  112. "{% elseif type == 'node' %}",
  113. "1",
  114. "{% else %}",
  115. "{% endif %}"
  116. ],
  117. "fillColor": [
  118. "{% if tags.railway == 'platform' %}",
  119. "#3f3f3f",
  120. "{% elseif type == 'node' %}",
  121. "#ffffff",
  122. "{% endif %}"
  123. ],
  124. "fillOpacity": [
  125. "{% if tags.railway == 'platform' %}",
  126. "0.2",
  127. "{% elseif type == 'node' %}",
  128. "0",
  129. "{% endif %}"
  130. ]
  131. },
  132. "style:highlight": {
  133. "width": [
  134. "{% if tags.railway in [ 'platform' ] %}",
  135. "1",
  136. "{% elseif tags.railway in [ 'signal', 'switch', 'railway_crossing' ] %}",
  137. "0",
  138. "{% elseif tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}",
  139. "1",
  140. "{% elseif tags.usage == 'main' or tags.usage == 'branch' %}",
  141. " 3",
  142. "{% else %}",
  143. " 2",
  144. "{% endif %}"
  145. ],
  146. "color": "#ffffff"
  147. }
  148. },
  149. "info": [
  150. "<table>",
  151. " <tr>",
  152. " <td>{{ markerLine(evaluate({ \"railway\": \"rail\", \"usage\": \"main\" }))|raw }}</td>",
  153. " <td>{{ tagTrans('railway', 'rail') }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', 'main') }}</td>",
  154. " </tr>",
  155. " <tr>",
  156. " <td>{{ markerLine(evaluate({ \"railway\": \"rail\", \"usage\": \"branch\" }))|raw }}</td>",
  157. " <td>{{ tagTrans('railway', 'rail') }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', 'branch') }}</td>",
  158. " </tr>",
  159. " <tr>",
  160. " <td>{{ markerLine(evaluate({ \"railway\": \"rail\" }))|raw }}</td>",
  161. " <td>{{ tagTrans('railway', 'rail') }}</td>",
  162. " </tr>",
  163. " <tr>",
  164. " <td>{{ markerLine(evaluate({ \"railway\": \"narrow_gauge\" }))|raw }}</td>",
  165. " <td>{{ tagTrans('railway', 'narrow_gauge') }}</td>",
  166. " </tr>",
  167. " <tr>",
  168. " <td>{{ markerLine(evaluate({ \"railway\": \"subway\" }))|raw }}</td>",
  169. " <td>{{ tagTrans('railway', 'subway') }}</td>",
  170. " </tr>",
  171. " <tr>",
  172. " <td>{{ markerLine(evaluate({ \"railway\": \"light_rail\" }))|raw }}</td>",
  173. " <td>{{ tagTrans('railway', 'light_rail') }}</td>",
  174. " </tr>",
  175. "{% if map.zoom >= 14 %}",
  176. " <tr>",
  177. " <td>{{ markerLine(evaluate({ \"railway\": \"tram\" }))|raw }}</td>",
  178. " <td>{{ tagTrans('railway', 'tram') }}</td>",
  179. " </tr>",
  180. "{% endif %}",
  181. "</table>"
  182. ],
  183. "const": {
  184. "rail": {
  185. "color": "#000000"
  186. },
  187. "narrow_gauge": {
  188. "color": "#7f003f"
  189. },
  190. "subway": {
  191. "color": "#0000ff"
  192. },
  193. "light_rail": {
  194. "color": "#7f00ff"
  195. },
  196. "tram": {
  197. "color": "#ff00ff"
  198. }
  199. }
  200. }