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.

142 lines
6.6 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~'^(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')) }}",
  48. "description": "{{ tagTrans('railway', tags.railway) }}",
  49. "details": [
  50. "{% if tags.electrified == 'no' %}",
  51. "{{ tagTrans('electrified', 'no') }}",
  52. "{% elseif tags.electrified %}",
  53. "{{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz",
  54. "{% endif %}"
  55. ],
  56. "body": [
  57. "{{ tagTrans('railway', tags.railway) }}<br/>",
  58. "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}",
  59. "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}",
  60. "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}",
  61. "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<br/>",
  62. "{% 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 %}"
  63. ],
  64. "markerSymbol": null,
  65. "listMarkerSymbol": "line",
  66. "styles": "casing,default",
  67. "priority": "{% if tags.railway == 'station' %}0{% elseif tags.railway in [ 'halt', 'tram_stop' ] %}1{% else %}5{% endif %}",
  68. "style": {
  69. "width": "{{ width }}",
  70. "lineCap": "butt",
  71. "color": "{{ color }}",
  72. "opacity": "1",
  73. "fill": null,
  74. "dashArray": [
  75. "{% if not tags.electrified is defined %}",
  76. "{% elseif not tags.frequency is defined or tags.frequency == 0 %}",
  77. "{% else %}",
  78. "5,2",
  79. "{% endif %}"
  80. ]
  81. },
  82. "style:casing": {
  83. "width": "{{ width }}",
  84. "color": "white",
  85. "opacity": "1",
  86. "lineCap": "butt",
  87. "fill": null
  88. }
  89. },
  90. "info": [
  91. "<table>",
  92. " <tr>",
  93. " <td>{{ markerLine({ 'width': 3, 'color': const.colorNone })|raw }}</td>",
  94. " <td>{{ trans('not electrified') }}</td>",
  95. " </tr>",
  96. "{% for i in range(0, const.range[1], const.infoSteps[0]) %}",
  97. " {% set color = colorInterpolate(const.scheme|slice(0, 2), i / const.range[1]) %}",
  98. " <tr>",
  99. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  100. " <td>{{ i }}V</td>",
  101. " </tr>",
  102. "{% endfor %}",
  103. "",
  104. "{% for i in range(const.range[1] + const.infoSteps[1], const.range[2], const.infoSteps[1]) %}",
  105. " {% set color = colorInterpolate(const.scheme|slice(1, 2), (i - const.range[1]) / (const.range[2] - const.range[1])) %}",
  106. " <tr>",
  107. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  108. " <td>{{ i }}V</td>",
  109. " </tr>",
  110. "{% endfor %}",
  111. "",
  112. "{% set color = const.scheme[1] %}",
  113. " <tr>",
  114. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  115. " <td>{{ trans('tag:frequency=0') }}</td>",
  116. " </tr>",
  117. "",
  118. " <tr>",
  119. " <td>{{ markerLine({ 'styles': [ 'casing', 'default' ], 'style:casing': { 'width': 3, 'color': 'white' }, 'style': { 'width': '3', 'dashArray': '5,2', 'lineCap': 'butt', 'color': color } })|raw }}</td>",
  120. " <td>{{ trans('tag:frequency>0') }}</td>",
  121. " </tr>",
  122. "",
  123. " <tr>",
  124. " <td>{{ markerLine({ 'width': 3, 'color': const.colorUnknown })|raw }}</td>",
  125. " <td>{{ trans('unknown') }}</td>",
  126. " </tr>",
  127. "",
  128. " <tr>",
  129. " <td>{{ markerLine({ 'width': 3, 'color': const.colorIllegal })|raw }}</td>",
  130. " <td>{{ trans('illegal value') }}</td>",
  131. " </tr>",
  132. "</table>"
  133. ],
  134. "const": {
  135. "range": [ 0, 1000, 25000 ],
  136. "infoSteps": [ 200, 2000 ],
  137. "scheme": [ "#00ff00", "#003fff", "#af0000" ],
  138. "colorNone": "orange",
  139. "colorUnknown": "#404040",
  140. "colorIllegal": "#ff0000"
  141. }
  142. }