Main categories of OpenStreetBrowser with public transport zoom level
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.

201 lines
8.8 KiB

  1. {
  2. "type": "overpass",
  3. "name": {
  4. "de": "Höchstgeschwindigkeiten",
  5. "en": "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[highway~\"^(motorway|trunk)$\"];",
  13. "13": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|tertiary)$\"];",
  14. "15": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|residential|unclassified)$\"];",
  15. "17": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|residential|unclassified|service|living_street|pedestrian|track|road)$\"];"
  16. },
  17. "feature": {
  18. "pre": [
  19. "{% set maxspeedKmh = null %}",
  20. "{% set maxspeed = null %}",
  21. "{% set unit = null %}",
  22. "",
  23. "{% if tags.maxspeed is defined %}",
  24. " {% if const.colorOther[tags.maxspeed] %}",
  25. " {% set maxspeed = tags.maxspeed %}",
  26. " {% elseif tags.maxspeed|matches(\"^[0-9]+$\") %}",
  27. " {% set maxspeedKmh = tags.maxspeed %}",
  28. " {% set maxspeed = tags.maxspeed %}",
  29. " {% set unit = \"km/h\" %}",
  30. " {% elseif tags.maxspeed|matches( \"(^[0-9]+) mph$\") %}",
  31. " {% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}",
  32. " {% set maxspeedKmh = m[1] * 1.60934 %}",
  33. " {% set maxspeed = m[1] %}",
  34. " {% set unit = \"mph\" %}",
  35. " {% endif %}",
  36. "{% endif %}",
  37. "",
  38. "{% if attribute(tags, 'maxspeed:forward') is defined %}",
  39. " {% set x = attribute(tags, 'maxspeed:forward') %}",
  40. " {% if const.colorOther[x] %}",
  41. " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}",
  42. " {% elseif attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+$\") %}",
  43. " {% set maxspeedFKmh = attribute(tags, 'maxspeed:forward') %}",
  44. " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}",
  45. " {% set unit = \"km/h\" %}",
  46. " {% elseif attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+ mph$\") %}",
  47. " {% set m = attribute(tags, 'maxspeed:forward')|matches(\"(^[0-9]+) mph$\") %}",
  48. " {% set maxspeedFKmh = m[1] * 1.60934 %}",
  49. " {% set maxspeedF = m[1] %}",
  50. " {% set unit = \"mph\" %}",
  51. " {% endif %}",
  52. "{% endif %}",
  53. "",
  54. "{% if attribute(tags, 'maxspeed:backward') is defined %}",
  55. " {% set x = attribute(tags, 'maxspeed:backward') %}",
  56. " {% if const.colorOther[x] %}",
  57. " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}",
  58. " {% elseif attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+$\") %}",
  59. " {% set maxspeedBKmh = attribute(tags, 'maxspeed:backward') %}",
  60. " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}",
  61. " {% set unit = \"km/h\" %}",
  62. " {% elseif attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+ mph$\") %}",
  63. " {% set m = attribute(tags, 'maxspeed:backward')|matches(\"(^[0-9]+) mph$\") %}",
  64. " {% set maxspeedBKmh = m[1] * 1.60934 %}",
  65. " {% set maxspeedB = m[1] %}",
  66. " {% set unit = \"mph\" %}",
  67. " {% endif %}",
  68. "{% endif %}",
  69. "",
  70. "{% if const.colorOther[maxspeed] %}",
  71. "{% set color = const.colorOther[maxspeed] %}",
  72. "{% elseif not maxspeedKmh %}",
  73. "{% set color = \"#404040\" %}",
  74. "{% else %}",
  75. "{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
  76. "{% endif %}",
  77. "",
  78. "{% if maxspeedF == 'none' %}",
  79. "{% set colorF = \"#0000ff\" %}",
  80. "{% elseif maxspeedFKmh %}",
  81. "{% set colorF = colorInterpolate(const.colorMap, (maxspeedFKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
  82. "{% endif %}",
  83. "",
  84. "{% if maxspeedB == 'none' %}",
  85. "{% set colorB = \"#0000ff\" %}",
  86. "{% elseif maxspeedBKmh %}",
  87. "{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
  88. "{% endif %}"
  89. ],
  90. "description": [
  91. "{% if maxspeedF or maxspeedB %}",
  92. "<span style='color: {{ colorB }}'>{{ const.colorOther[maxspeedB] ? tagTrans('maxspeed', maxspeedB) : maxspeedB|default(trans('unknown')) }}</span> / <span style='color: {{ colorF }}'>{{ const.colorOther[maxspeedF] ? tagTrans('maxspeed', maxspeedF) : maxspeedF|default(trans('unknown')) }}</span> {{ unit }}",
  93. "{% elseif maxspeed %}",
  94. "<span style='color: {{ color }}'>{{ const.colorOther[maxspeed] ? tagTrans('maxspeed', maxspeed) : maxspeed }} {{ unit }}</span>",
  95. "{% elseif tags.maxspeed %}",
  96. "{{ tags.maxspeed }}",
  97. "{% else %}",
  98. "{{ trans('unknown') }}",
  99. "{% endif %}"
  100. ],
  101. "markerSymbol": "",
  102. "listMarkerSymbol": "line",
  103. "styles": "{% if maxspeedB or maxspeedF %}left,right,default{% else %}default{% endif %}",
  104. "style": {
  105. "width": "{% if maxspeedB or maxspeedF %}0{% else %}4{% endif %}",
  106. "color": "{{ color }}",
  107. "text": [
  108. "{% if maxspeedB or maxspeedF %}",
  109. " {% if maxspeedB %}🡸 {{ maxspeedB }} {% endif %}|{% if maxspeedF %} {{ maxspeedF }} 🡺{% endif %} ",
  110. "{% else %}",
  111. " {{ maxspeed }} ",
  112. "{% endif %}"
  113. ],
  114. "textRepeat": "1",
  115. "textOffset": "4",
  116. "textFontWeight": "bold"
  117. },
  118. "style:left": {
  119. "width": "2",
  120. "color": "{{ colorB|default('#404040') }}",
  121. "offset": "-1"
  122. },
  123. "style:right": {
  124. "width": "2",
  125. "color": "{{ colorF|default('#404040') }}",
  126. "offset": "1"
  127. }
  128. },
  129. "const": {
  130. "colorMap": [
  131. "#00af00",
  132. "#ff7f00",
  133. "#ff0000",
  134. "#af00af"
  135. ],
  136. "colorOther": {
  137. "none": "#0000ff",
  138. "walk": "#00afff"
  139. },
  140. "highestColorSpeed": 150,
  141. "offsetColorSpeed": 10
  142. },
  143. "info": [
  144. "<div style='display: inline-block; width: 49%;'>",
  145. "<table>",
  146. " <tr>",
  147. " <td>{{ markerLine(evaluate({}))|raw }}</td>",
  148. " <td colspan>{{ trans('unknown') }}</td>",
  149. " </tr>",
  150. " <tr>",
  151. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"walk\" }))|raw }}</td>",
  152. " <td colspan>{{ tagTrans('maxspeed', 'walk') }}</td>",
  153. " </tr>",
  154. "{% for i in range(10, 140, 20) %}",
  155. " <tr>",
  156. " <td>{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}</td>",
  157. " <td>{{ i }}km/h</td>",
  158. " </tr>",
  159. "{% endfor %}",
  160. " <tr>",
  161. " <td>{{ markerLine(evaluate({ \"maxspeed\": 150 }))|raw }}</td>",
  162. " <td>≥150km/h</td>",
  163. " </tr>",
  164. " <tr>",
  165. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}</td>",
  166. " <td>{{ tagTrans('maxspeed', 'none') }}</td>",
  167. " </tr>",
  168. "</table>",
  169. "</div>",
  170. "<div style='display: inline-block; width: 49%;'>",
  171. "<table>",
  172. " <tr>",
  173. " <td>{{ markerLine(evaluate({}))|raw }}</td>",
  174. " <td colspan>{{ trans('unknown') }}</td>",
  175. " </tr>",
  176. " <tr>",
  177. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"walk\" }))|raw }}</td>",
  178. " <td colspan>{{ tagTrans('maxspeed', 'walk') }}</td>",
  179. " </tr>",
  180. "{% for i in range(10, 60, 10) %}",
  181. " <tr>",
  182. " <td>{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}</td>",
  183. " <td>{{ i }}mph</td>",
  184. " </tr>",
  185. "{% endfor %}",
  186. " <tr>",
  187. " <td>{{ markerLine(evaluate({ \"maxspeed\": (75 * 1.60934)|round }))|raw }}</td>",
  188. " <td>75mph</td>",
  189. " </tr>",
  190. " <tr>",
  191. " <td>{{ markerLine(evaluate({ \"maxspeed\": (95 * 1.60934)|round }))|raw }}</td>",
  192. " <td>≥95mph</td>",
  193. " </tr>",
  194. " <tr>",
  195. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}</td>",
  196. " <td>{{ tagTrans('maxspeed', 'none') }}</td>",
  197. " </tr>",
  198. "</table>",
  199. "</div>"
  200. ]
  201. }