Main categories of OpenStreetBrowser

railway-electrification.json 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$'];"
  14. },
  15. "feature": {
  16. "pre": [
  17. "{% if tags.electrified and tags.electrified != 'no' %}",
  18. " {% if not tags.voltage is defined %}",
  19. " {% set color = const.colorUnknown %}",
  20. " {% elseif not tags.voltage|matches('^[0-9]+$') %}",
  21. " {% set color = const.colorIllegal %}",
  22. " {% elseif tags.voltage < const.range[1] %}",
  23. " {% set color = colorInterpolate(const.scheme|slice(0, 2), tags.voltage / const.range[1]) %}",
  24. " {% else %}",
  25. " {% set color = colorInterpolate(const.scheme|slice(1, 2), (tags.voltage - const.range[1]) / (const.range[2] - const.range[1])) %}",
  26. " {% endif %}",
  27. "{% elseif tags.electrified and tags.electrified == 'no' %}",
  28. " {% set color = const.colorNone %}",
  29. "{% else %}",
  30. " {% set color = const.colorUnknown %}",
  31. "{% endif %}",
  32. "",
  33. "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}",
  34. " {% set width=2 %}",
  35. " {% else %}",
  36. " {% if tags.railway == 'rail' %}",
  37. " {% if tags.usage == 'main' or tags.usage == 'branch' %}",
  38. " {% set width=4 %}",
  39. " {% else %}",
  40. " {% set width=3 %}",
  41. " {% endif %}",
  42. " {% else %}",
  43. " {% set width=2 %}",
  44. " {% endif %}",
  45. "{% endif %}"
  46. ],
  47. "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
  48. "description": [
  49. "{{ tagTrans('railway', tags.railway) }}",
  50. "",
  51. "{% if tags.electrified == 'no' %}",
  52. " - {{ tagTrans('electrified', 'no') }}",
  53. "{% elseif tags.electrified %}",
  54. " - {{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz",
  55. "{% endif %}"
  56. ],
  57. "body": [
  58. "{{ tagTrans('railway', tags.railway) }}<br/>",
  59. "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}",
  60. "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}",
  61. "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}",
  62. "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<br/>",
  63. "{% 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 %}"
  64. ],
  65. "markerSymbol": null,
  66. "listMarkerSymbol": "line",
  67. "styles": "casing,default",
  68. "priority": "{% if tags.railway == 'station' %}0{% elseif tags.railway in [ 'halt', 'tram_stop' ] %}1{% else %}5{% endif %}",
  69. "style": {
  70. "width": "{{ width }}",
  71. "lineCap": "butt",
  72. "color": "{{ color }}",
  73. "opacity": "1",
  74. "fill": null,
  75. "dashArray": [
  76. "{% if not tags.electrified is defined %}",
  77. "{% elseif not tags.frequency is defined or tags.frequency == 0 %}",
  78. "{% else %}",
  79. "5,2",
  80. "{% endif %}"
  81. ]
  82. },
  83. "style:casing": {
  84. "width": "{{ width }}",
  85. "color": "white",
  86. "opacity": "1",
  87. "lineCap": "butt",
  88. "fill": null
  89. }
  90. },
  91. "info": [
  92. "<table>",
  93. " <tr>",
  94. " <td>{{ markerLine({ 'width': 3, 'color': const.colorNone })|raw }}</td>",
  95. " <td>{{ trans('not electrified') }}</td>",
  96. " </tr>",
  97. "{% for i in range(0, const.range[1], const.infoSteps[0]) %}",
  98. " {% set color = colorInterpolate(const.scheme|slice(0, 2), i / const.range[1]) %}",
  99. " <tr>",
  100. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  101. " <td>{{ i }}V</td>",
  102. " </tr>",
  103. "{% endfor %}",
  104. "",
  105. "{% for i in range(const.range[1] + const.infoSteps[1], const.range[2], const.infoSteps[1]) %}",
  106. " {% set color = colorInterpolate(const.scheme|slice(1, 2), (i - const.range[1]) / (const.range[2] - const.range[1])) %}",
  107. " <tr>",
  108. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  109. " <td>{{ i }}V</td>",
  110. " </tr>",
  111. "{% endfor %}",
  112. "",
  113. "{% set color = const.scheme[1] %}",
  114. " <tr>",
  115. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  116. " <td>{{ trans('tag:frequency=0') }}</td>",
  117. " </tr>",
  118. "",
  119. " <tr>",
  120. " <td>{{ markerLine({ 'styles': [ 'casing', 'default' ], 'style:casing': { 'width': 3, 'color': 'white' }, 'style': { 'width': '3', 'dashArray': '5,2', 'lineCap': 'butt', 'color': color } })|raw }}</td>",
  121. " <td>{{ trans('tag:frequency>0') }}</td>",
  122. " </tr>",
  123. "",
  124. " <tr>",
  125. " <td>{{ markerLine({ 'width': 3, 'color': const.colorUnknown })|raw }}</td>",
  126. " <td>{{ trans('unknown') }}</td>",
  127. " </tr>",
  128. "",
  129. " <tr>",
  130. " <td>{{ markerLine({ 'width': 3, 'color': const.colorIllegal })|raw }}</td>",
  131. " <td>{{ trans('illegal value') }}</td>",
  132. " </tr>",
  133. "</table>"
  134. ],
  135. "const": {
  136. "range": [ 0, 1000, 25000 ],
  137. "infoSteps": [ 200, 2000 ],
  138. "scheme": [ "#00ff00", "#003fff", "#af0000" ],
  139. "colorNone": "orange",
  140. "colorUnknown": "#404040",
  141. "colorIllegal": "#ff0000"
  142. }
  143. }