Main categories of OpenStreetBrowser

railway-gauge.json 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {
  2. "type": "overpass",
  3. "name": {
  4. "en": "Railway gauge"
  5. },
  6. "query": {
  7. "11": "way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$'];",
  8. "14": "way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$'];"
  9. },
  10. "feature": {
  11. "pre": [
  12. "{% set gauges = tags.gauge|split(';')|sort|reverse %}",
  13. "{% set width = max(3, 3 / map.metersPerPixel) %}"
  14. ],
  15. "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}",
  16. "description": "{{ tags.gauge|default(trans('unknown'))|enumerate }}",
  17. "body": [
  18. "{{ tagTrans('railway', tags.railway) }}<br/>",
  19. "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}",
  20. "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}",
  21. "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}",
  22. "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown'))|enumerate }}<br/>",
  23. "{% 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 %}"
  24. ],
  25. "markerSymbol": null,
  26. "listMarkerSymbol": "line",
  27. "styles": "{% if gauges|length < 2 %}default{% else %}{% for i, v in gauges %}{% if i != 0 %},{% endif %}gauge{{ i }}{% endfor %}{% endif %}{% if gauges|length > 0 and map.zoom >= 18 %},rail{% for i, v in gauges %},rail{{ i }}{% endfor %}{% endif %}",
  28. "style": {
  29. "width": "{{ width }}",
  30. "pane": "casing",
  31. "color": "{% if tags.gauge %}{% if not tags.gauge|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], tags.gauge / 2000) }}{% endif %}{% else %}#404040{% endif %}"
  32. },
  33. "style:rail": {
  34. "width": "1",
  35. "color": "#ffffff",
  36. "offset": "{{ gauges[0] / -2000 }}m"
  37. },
  38. "style:gauge0": {
  39. "width": "{{ width }}",
  40. "pane": "casing",
  41. "lineCap": "butt",
  42. "color": "{% if not gauges[0]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[0] / 2000) }}{% endif %}",
  43. "dashArray": "5,{{ (gauges|length - 1) * 5 }}"
  44. },
  45. "style:rail0": {
  46. "width": "1",
  47. "color": "#ffffff",
  48. "offset": "{{ gauges[0] / 2000 }}m"
  49. },
  50. "style:gauge1": {
  51. "width": "{{ width }}",
  52. "pane": "casing",
  53. "lineCap": "butt",
  54. "color": "{% if not gauges[1]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[1] / 2000) }}{% endif %}",
  55. "dashArray": "5,{{ (gauges|length - 1) * 5 }}",
  56. "dashOffset": "5"
  57. },
  58. "style:rail1": {
  59. "width": "1",
  60. "color": "#ffffff",
  61. "offset": "{{ gauges[0] / -2000 + gauges[1] / 1000 }}m"
  62. },
  63. "style:gauge2": {
  64. "width": "{{ width }}",
  65. "pane": "casing",
  66. "lineCap": "butt",
  67. "color": "{% if not gauges[2]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[2] / 2000) }}{% endif %}",
  68. "dashArray": "5,{{ (gauges|length - 1) * 5 }}",
  69. "dashOffset": "10"
  70. },
  71. "style:rail2": {
  72. "width": "1",
  73. "color": "#ffffff",
  74. "offset": "{{ gauges[0] / -2000 + gauges[2] / 1000 }}m"
  75. },
  76. "style:gauge3": {
  77. "width": "{{ width }}",
  78. "pane": "casing",
  79. "lineCap": "butt",
  80. "color": "{% if not gauges[3]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[3] / 2000) }}{% endif %}",
  81. "dashArray": "5,{{ (gauges|length - 1) * 5 }}",
  82. "dashOffset": "15"
  83. },
  84. "style:rail3": {
  85. "width": "1",
  86. "color": "#ffffff",
  87. "offset": "{{ gauges[0] / -2000 + gauges[3] / 1000 }}m"
  88. }
  89. },
  90. "info": [
  91. "<table>",
  92. " {% set color = '#ff0000' %}",
  93. " <tr>",
  94. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  95. " <td>{{ trans('illegal value') }}</td>",
  96. " </tr>",
  97. " {% set color = '#404040' %}",
  98. " <tr>",
  99. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  100. " <td>{{ trans('unknown') }}</td>",
  101. " </tr>",
  102. "{% for i in range(0, 1800, 250) %}",
  103. " {% set color = colorInterpolate([ '#00ff00', '#0000ff' ], i / 2000) %}",
  104. " <tr>",
  105. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  106. " <td>{{ i }}mm</td>",
  107. " </tr>",
  108. "{% endfor %}",
  109. " <tr>",
  110. " <td>{{ markerLine({ 'width': 3, 'color': '#0000ff' })|raw }}</td>",
  111. " <td>>2000mm</td>",
  112. " </tr>",
  113. "</table>"
  114. ]
  115. }