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.

166 lines
6.7 KiB

  1. {
  2. "type": "overpass",
  3. "name": {
  4. "de": "Eisenbahn Höchstgeschwindigkeiten",
  5. "en": "Railway Maxspeed",
  6. "fr": "Limites de vitesse",
  7. "hu": "Sebességkorlátozás",
  8. "pt": "Velocidade máxima",
  9. "pt-br": "Velocidade máxima"
  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. "{% set maxspeedKmh = null %}",
  18. "{% set maxspeed = null %}",
  19. "{% set unit = null %}",
  20. "",
  21. "{% if tags.maxspeed is defined %}",
  22. " {% if tags.maxspeed|matches(\"^[0-9]+$\") %}",
  23. " {% set maxspeedKmh = tags.maxspeed %}",
  24. " {% set maxspeed = tags.maxspeed %}",
  25. " {% set unit = \"km/h\" %}",
  26. " {% elseif tags.maxspeed|matches( \"(^[0-9]+) mph$\") %}",
  27. " {% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}",
  28. " {% set maxspeedKmh = m[1] * 1.60934 %}",
  29. " {% set maxspeed = m[1] %}",
  30. " {% set unit = \"mph\" %}",
  31. " {% endif %}",
  32. "{% endif %}",
  33. "",
  34. "{% if attribute(tags, 'maxspeed:forward') is defined %}",
  35. " {% if attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+$\") %}",
  36. " {% set maxspeedFKmh = attribute(tags, 'maxspeed:forward') %}",
  37. " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}",
  38. " {% set unit = \"km/h\" %}",
  39. " {% elseif attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+ mph$\") %}",
  40. " {% set m = attribute(tags, 'maxspeed:forward')|matches(\"(^[0-9]+) mph$\") %}",
  41. " {% set maxspeedFKmh = m[1] * 1.60934 %}",
  42. " {% set maxspeedF = m[1] %}",
  43. " {% set unit = \"mph\" %}",
  44. " {% endif %}",
  45. "{% endif %}",
  46. "",
  47. "{% if attribute(tags, 'maxspeed:backward') is defined %}",
  48. " {% if attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+$\") %}",
  49. " {% set maxspeedBKmh = attribute(tags, 'maxspeed:backward') %}",
  50. " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}",
  51. " {% set unit = \"km/h\" %}",
  52. " {% elseif attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+ mph$\") %}",
  53. " {% set m = attribute(tags, 'maxspeed:backward')|matches(\"(^[0-9]+) mph$\") %}",
  54. " {% set maxspeedBKmh = m[1] * 1.60934 %}",
  55. " {% set maxspeedB = m[1] %}",
  56. " {% set unit = \"mph\" %}",
  57. " {% endif %}",
  58. "{% endif %}",
  59. "",
  60. "{% if not maxspeedKmh %}",
  61. "{% set color = \"#404040\" %}",
  62. "{% else %}",
  63. "{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
  64. "{% endif %}",
  65. "",
  66. "{% if maxspeedFKmh %}",
  67. "{% set colorF = colorInterpolate(const.colorMap, (maxspeedFKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
  68. "{% endif %}",
  69. "",
  70. "{% if maxspeedBKmh %}",
  71. "{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
  72. "{% endif %}"
  73. ],
  74. "description": [
  75. "{% if maxspeedF or maxspeedB %}",
  76. "<span style='color: {{ colorB }}'>{{ maxspeedB|default(trans('unknown')) }}</span> / <span style='color: {{ colorF }}'>{{ maxspeedF|default(trans('unknown')) }}</span> {{ unit }}",
  77. "{% elseif maxspeed %}",
  78. "<span style='color: {{ color }}'>{{ maxspeed }} {{ unit }}</span>",
  79. "{% elseif tags.maxspeed %}",
  80. "{{ tags.maxspeed }}",
  81. "{% else %}",
  82. "{{ trans('unknown') }}",
  83. "{% endif %}"
  84. ],
  85. "markerSymbol": null,
  86. "listMarkerSymbol": "line",
  87. "styles": "{% if maxspeedB or maxspeedF %}left,right,default{% else %}default{% endif %}",
  88. "style": {
  89. "width": "{% if maxspeedB or maxspeedF %}0{% else %}4{% endif %}",
  90. "color": "{{ color }}",
  91. "text": [
  92. "{% if maxspeedB or maxspeedF %}",
  93. " {% if maxspeedB %}🡸 {{ maxspeedB }} {% endif %}|{% if maxspeedF %} {{ maxspeedF }} 🡺{% endif %} ",
  94. "{% else %}",
  95. " {{ maxspeed }} ",
  96. "{% endif %}"
  97. ],
  98. "textRepeat": "1",
  99. "textOffset": "4",
  100. "textFontWeight": "bold"
  101. },
  102. "style:left": {
  103. "width": "2",
  104. "color": "{{ colorB|default('#404040') }}",
  105. "offset": "-1"
  106. },
  107. "style:right": {
  108. "width": "2",
  109. "color": "{{ colorF|default('#404040') }}",
  110. "offset": "1"
  111. }
  112. },
  113. "const": {
  114. "colorMap": [
  115. "#00af00",
  116. "#ff7f00",
  117. "#ff0000",
  118. "#af00af"
  119. ],
  120. "highestColorSpeed": 300,
  121. "offsetColorSpeed": 20
  122. },
  123. "info": [
  124. "<div style='display: inline-block'>",
  125. "<table>",
  126. " <tr>",
  127. " <td>{{ markerLine(evaluate({}))|raw }}</td>",
  128. " <td colspan>{{ trans('unknown') }}</td>",
  129. " </tr>",
  130. "{% for i in range(25, 280, 25) %}",
  131. " <tr>",
  132. " <td>{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}</td>",
  133. " <td>{{ i }}km/h</td>",
  134. " </tr>",
  135. "{% endfor %}",
  136. " <tr>",
  137. " <td>{{ markerLine(evaluate({ \"maxspeed\": 300 }))|raw }}</td>",
  138. " <td>≥300km/h</td>",
  139. " </tr>",
  140. "</table>",
  141. "</div>",
  142. "",
  143. "<div style='display: inline-block'>",
  144. "<table>",
  145. " <tr>",
  146. " <td>{{ markerLine(evaluate({}))|raw }}</td>",
  147. " <td colspan>{{ trans('unknown') }}</td>",
  148. " </tr>",
  149. "{% for i in range(15, 150, 15) %}",
  150. " <tr>",
  151. " <td>{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}</td>",
  152. " <td>{{ i }}mph</td>",
  153. " </tr>",
  154. "{% endfor %}",
  155. " <tr>",
  156. " <td>{{ markerLine(evaluate({ \"maxspeed\": (175 * 1.60934)|round }))|raw }}</td>",
  157. " <td>175mph</td>",
  158. " </tr>",
  159. " <tr>",
  160. " <td>{{ markerLine(evaluate({ \"maxspeed\": (200 * 1.60934)|round }))|raw }}</td>",
  161. " <td>≥200mph</td>",
  162. " </tr>",
  163. "</table>",
  164. "</div>"
  165. ]
  166. }