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.

114 lines
5.2 KiB

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