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.

202 lines
9.1 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": [
  97. "{% if maxspeedF or maxspeedB %}",
  98. "<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 }}",
  99. "{% elseif maxspeed %}",
  100. "<span style='color: {{ color }}'>{{ maxspeed == 'other' ? tags.maxspeed : const.colorOther[maxspeed] ? tagTrans('maxspeed', maxspeed) : maxspeed }} {{ unit }}</span>",
  101. "{% elseif tags.maxspeed %}",
  102. "{{ tags.maxspeed }}",
  103. "{% else %}",
  104. "{{ trans('unknown') }}",
  105. "{% endif %}"
  106. ],
  107. "markerSymbol": "",
  108. "listMarkerSymbol": "line",
  109. "styles": "{% if maxspeedB or maxspeedF %}left,right,default{% else %}default{% endif %}",
  110. "style": {
  111. "width": "{% if maxspeedB or maxspeedF %}0{% else %}4{% endif %}",
  112. "color": "{{ color }}",
  113. "text": [
  114. "{% if maxspeedB or maxspeedF %}",
  115. " {% if maxspeedB %}🡸 {{ maxspeedB == 'other' ? attribute(tags, 'maxspeed:backward') : maxspeedB }} {% endif %}|{% if maxspeedF %} {{ maxspeedF == 'other' ? attribute(tags, 'maxspeed:forward') : maxspeedF }} 🡺{% endif %} ",
  116. "{% else %}",
  117. " {{ maxspeed == 'other' ? tags.maxspeed : maxspeed }} ",
  118. "{% endif %}"
  119. ],
  120. "textRepeat": "1",
  121. "textOffset": "4",
  122. "textFontWeight": "bold"
  123. },
  124. "style:left": {
  125. "width": "2",
  126. "color": "{{ colorB|default('#404040') }}",
  127. "offset": "-1"
  128. },
  129. "style:right": {
  130. "width": "2",
  131. "color": "{{ colorF|default('#404040') }}",
  132. "offset": "1"
  133. }
  134. },
  135. "const": {
  136. "colorMap": [
  137. "#00af00",
  138. "#ff7f00",
  139. "#ff0000",
  140. "#af00af"
  141. ],
  142. "colorOther": {
  143. "none": "#ff00ff",
  144. "walk": "#00afff",
  145. "other": "#0000ff"
  146. },
  147. "highestColorSpeed": 150,
  148. "offsetColorSpeed": 10
  149. },
  150. "info": [
  151. "<table>",
  152. " <tr>",
  153. " <td>{{ markerLine(evaluate({}))|raw }}</td>",
  154. " <td colspan>{{ trans('unknown') }}</td>",
  155. " </tr>",
  156. " <tr>",
  157. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"walk\" }))|raw }}</td>",
  158. " <td colspan>{{ tagTrans('maxspeed', 'walk') }}</td>",
  159. " </tr>",
  160. " <tr>",
  161. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}</td>",
  162. " <td>{{ tagTrans('maxspeed', 'none') }}</td>",
  163. " </tr>",
  164. " <tr>",
  165. " <td>{{ markerLine(evaluate({ \"maxspeed\": \"other\" }))|raw }}</td>",
  166. " <td>{{ trans('other') }}</td>",
  167. " </tr>",
  168. "</table>",
  169. "<div style='display: inline-block; width: 49%;'>",
  170. "<table>",
  171. "{% for i in range(10, 140, 20) %}",
  172. " <tr>",
  173. " <td>{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}</td>",
  174. " <td>{{ i }}km/h</td>",
  175. " </tr>",
  176. "{% endfor %}",
  177. " <tr>",
  178. " <td>{{ markerLine(evaluate({ \"maxspeed\": 150 }))|raw }}</td>",
  179. " <td>≥150km/h</td>",
  180. " </tr>",
  181. "</table>",
  182. "</div>",
  183. "<div style='display: inline-block; width: 49%;'>",
  184. "<table>",
  185. "{% for i in range(10, 60, 10) %}",
  186. " <tr>",
  187. " <td>{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}</td>",
  188. " <td>{{ i }}mph</td>",
  189. " </tr>",
  190. "{% endfor %}",
  191. " <tr>",
  192. " <td>{{ markerLine(evaluate({ \"maxspeed\": (75 * 1.60934)|round }))|raw }}</td>",
  193. " <td>75mph</td>",
  194. " </tr>",
  195. " <tr>",
  196. " <td>{{ markerLine(evaluate({ \"maxspeed\": (95 * 1.60934)|round }))|raw }}</td>",
  197. " <td>≥95mph</td>",
  198. " </tr>",
  199. "</table>",
  200. "</div>"
  201. ]
  202. }