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.

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