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.

191 lines
8.3 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. "<table>",
  145. " <tr>",
  146. " <td>{{ markerLine(evaluate({}))|raw }}</td>",
  147. " <td colspan>{{ trans('unknown') }}</td>",
  148. " </tr>",
  149. " <tr>",
  150. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"walk\" }))|raw }}</td>",
  151. " <td colspan>{{ tagTrans('maxspeed', 'walk') }}</td>",
  152. " </tr>",
  153. " <tr>",
  154. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}</td>",
  155. " <td>{{ tagTrans('maxspeed', 'none') }}</td>",
  156. " </tr>",
  157. "</table>",
  158. "<div style='display: inline-block; width: 49%;'>",
  159. "<table>",
  160. "{% for i in range(10, 140, 20) %}",
  161. " <tr>",
  162. " <td>{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}</td>",
  163. " <td>{{ i }}km/h</td>",
  164. " </tr>",
  165. "{% endfor %}",
  166. " <tr>",
  167. " <td>{{ markerLine(evaluate({ \"maxspeed\": 150 }))|raw }}</td>",
  168. " <td>≥150km/h</td>",
  169. " </tr>",
  170. "</table>",
  171. "</div>",
  172. "<div style='display: inline-block; width: 49%;'>",
  173. "<table>",
  174. "{% for i in range(10, 60, 10) %}",
  175. " <tr>",
  176. " <td>{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}</td>",
  177. " <td>{{ i }}mph</td>",
  178. " </tr>",
  179. "{% endfor %}",
  180. " <tr>",
  181. " <td>{{ markerLine(evaluate({ \"maxspeed\": (75 * 1.60934)|round }))|raw }}</td>",
  182. " <td>75mph</td>",
  183. " </tr>",
  184. " <tr>",
  185. " <td>{{ markerLine(evaluate({ \"maxspeed\": (95 * 1.60934)|round }))|raw }}</td>",
  186. " <td>≥95mph</td>",
  187. " </tr>",
  188. "</table>",
  189. "</div>"
  190. ]
  191. }