Main categories of OpenStreetBrowser with support for whitewater
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.

90 lines
4.6 KiB

  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(';') %}",
  13. "{% set width = max(3, 2.5 / map.metersPerPixel) %}"
  14. ],
  15. "title": "{{ width }}{% 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 %}",
  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:gauge0": {
  34. "width": "{{ width }}",
  35. "pane": "casing",
  36. "lineCap": "butt",
  37. "color": "{% if not gauges[0]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[0] / 2000) }}{% endif %}",
  38. "dashArray": "5,{{ (gauges|length - 1) * 5 }}"
  39. },
  40. "style:gauge1": {
  41. "width": "{{ width }}",
  42. "pane": "casing",
  43. "lineCap": "butt",
  44. "color": "{% if not gauges[1]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[1] / 2000) }}{% endif %}",
  45. "dashArray": "5,{{ (gauges|length - 1) * 5 }}",
  46. "dashOffset": "5"
  47. },
  48. "style:gauge2": {
  49. "width": "{{ width }}",
  50. "pane": "casing",
  51. "lineCap": "butt",
  52. "color": "{% if not gauges[2]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[2] / 2000) }}{% endif %}",
  53. "dashArray": "5,{{ (gauges|length - 1) * 5 }}",
  54. "dashOffset": "10"
  55. },
  56. "style:gauge3": {
  57. "width": "{{ width }}",
  58. "pane": "casing",
  59. "lineCap": "butt",
  60. "color": "{% if not gauges[3]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[3] / 2000) }}{% endif %}",
  61. "dashArray": "5,{{ (gauges|length - 1) * 5 }}",
  62. "dashOffset": "15"
  63. }
  64. },
  65. "info": [
  66. "<table>",
  67. " {% set color = '#ff0000' %}",
  68. " <tr>",
  69. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  70. " <td>{{ trans('illegal value') }}</td>",
  71. " </tr>",
  72. " {% set color = '#404040' %}",
  73. " <tr>",
  74. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  75. " <td>{{ trans('unknown') }}</td>",
  76. " </tr>",
  77. "{% for i in range(0, 1800, 250) %}",
  78. " {% set color = colorInterpolate([ '#00ff00', '#0000ff' ], i / 2000) %}",
  79. " <tr>",
  80. " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
  81. " <td>{{ i }}mm</td>",
  82. " </tr>",
  83. "{% endfor %}",
  84. " <tr>",
  85. " <td>{{ markerLine({ 'width': 3, 'color': '#0000ff' })|raw }}</td>",
  86. " <td>>2000mm</td>",
  87. " </tr>",
  88. "</table>"
  89. ]
  90. }