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.

132 lines
5.9 KiB

7 years ago
7 years ago
  1. {
  2. "type": "overpass",
  3. "name": {
  4. "de": "Eisenbahn Elektrifizierung",
  5. "en": "Railway electrification",
  6. "fr": "Puissance électrique ferroviaire",
  7. "hu": "Vasút villamosítottsága",
  8. "pt": "Eletrificação ferroviária",
  9. "pt-br": "Eletrificação ferroviária"
  10. },
  11. "query": {
  12. "11": "way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$'];",
  13. "14": "way[railway][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'];"
  14. },
  15. "feature": {
  16. "pre": [
  17. "{% if tags.electrified and tags.electrified != 'no' %}",
  18. " {% if not tags.voltage is defined %}",
  19. " {% set color = '#7f7f7f' %}",
  20. " {% elseif not tags.voltage|matches('^[0-9]+$') %}",
  21. " {% set color = '#ff0000' %}",
  22. " {% elseif tags.voltage < 1000 %}",
  23. " {% set color = colorInterpolate([ '#00ff00', 'blue' ], tags.voltage / 1000) %}",
  24. " {% else %}",
  25. " {% set color = colorInterpolate([ 'blue', '#af0000' ], (tags.voltage - 1000) / 24000) %}",
  26. " {% endif %}",
  27. "{% else %}",
  28. " {% set color = 'black' %}",
  29. "{% endif %}",
  30. "",
  31. "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}",
  32. " {% set width=2 %}",
  33. " {% else %}",
  34. " {% if tags.railway == 'rail' %}",
  35. " {% if tags.usage == 'main' or tags.usage == 'branch' %}",
  36. " {% set width=3 %}",
  37. " {% else %}",
  38. " {% set width=2.5 %}",
  39. " {% endif %}",
  40. " {% else %}",
  41. " {% set width=2 %}",
  42. " {% endif %}",
  43. "{% endif %}"
  44. ],
  45. "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
  46. "description": [
  47. "{{ tagTrans('railway', tags.railway) }}",
  48. "",
  49. "{% if tags.electrified == 'no' %}",
  50. " - {{ tagTrans('electrified', 'no') }}",
  51. "{% elseif tags.electrified %}",
  52. " - {{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz",
  53. "{% endif %}"
  54. ],
  55. "body": [
  56. "{{ tagTrans('railway', tags.railway) }}<br/>",
  57. "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}",
  58. "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}",
  59. "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}",
  60. "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<br/>",
  61. "{% 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 %}"
  62. ],
  63. "markerSymbol": null,
  64. "listMarkerSymbol": "line",
  65. "styles": "casing,default",
  66. "priority": "{% if tags.railway == 'station' %}0{% elseif tags.railway in [ 'halt', 'tram_stop' ] %}1{% else %}5{% endif %}",
  67. "style": {
  68. "width": "{{ width }}",
  69. "lineCap": "butt",
  70. "color": "{{ color }}",
  71. "opacity": "1",
  72. "fill": null,
  73. "dashArray": [
  74. "{% if not tags.electrified is defined %}",
  75. "{% elseif tags.frequency == 0 %}",
  76. "{% else %}",
  77. "5,2",
  78. "{% endif %}"
  79. ]
  80. },
  81. "style:casing": {
  82. "width": "{{ width }}",
  83. "color": "white",
  84. "opacity": "1",
  85. "fill": null
  86. }
  87. },
  88. "info": [
  89. "<table>",
  90. " {% set color = '#000000' %}",
  91. " <tr>",
  92. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  93. " <td>{{ trans('not electrified') }}</td>",
  94. " </tr>",
  95. "{% for i in range(0, 1000, 200) %}",
  96. " {% set color = colorInterpolate([ '#00ff00', 'blue' ], i / 1000) %}",
  97. " <tr>",
  98. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  99. " <td>{{ i }}V</td>",
  100. " </tr>",
  101. "{% endfor %}",
  102. "",
  103. "{% for i in range(3000, 25000, 2000) %}",
  104. " {% set color = colorInterpolate([ 'blue', '#af0000' ], (i - 1000) / 24000) %}",
  105. " <tr>",
  106. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  107. " <td>{{ i }}V</td>",
  108. " </tr>",
  109. "{% endfor %}",
  110. "",
  111. " <tr>",
  112. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  113. " <td>{{ trans('direct current') }}</td>",
  114. " </tr>",
  115. "",
  116. " <tr>",
  117. " <td>{{ markerLine({ 'styles': [ 'casing', 'default' ], 'style:casing': { 'width': 3, 'color': 'white' }, 'style': { 'width': '3', 'dashArray': '5,2', 'lineCap': 'butt', 'color': color } })|raw }}</td>",
  118. " <td>{{ trans('alternating current') }}</td>",
  119. " </tr>",
  120. "",
  121. " <tr>",
  122. " <td>{{ markerLine({ 'width': 3, 'color': '#7f7f7f' })|raw }}</td>",
  123. " <td>{{ trans('unknown') }}</td>",
  124. " </tr>",
  125. "",
  126. " <tr>",
  127. " <td>{{ markerLine({ 'width': 3, 'color': '#ff0000' })|raw }}</td>",
  128. " <td>{{ trans('illegal value') }}</td>",
  129. " </tr>",
  130. "</table>"
  131. ]
  132. }