Browse Source

railway-maxspeed: new category

maxspeed
parent
commit
a1c25cfe76
  1. 3
      index.json
  2. 114
      railway-maxspeed.json

3
index.json

@ -277,6 +277,9 @@
{
"id": "railway-electrification"
},
{
"id": "railway-maxspeed"
},
{
"id": "railway-routes"
}

114
railway-maxspeed.json

@ -0,0 +1,114 @@
{
"type": "overpass",
"name": {
"de": "Höchstgeschwindigkeiten",
"en": "Maxspeed",
"fr": "Limites de vitesse",
"hu": "Sebességkorlátozás",
"pt": "Velocidade máxima",
"pt-br": "Velocidade máxima"
},
"query": {
"11": "way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$'];",
"14": "way[railway][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'];"
},
"feature": {
"pre": [
"{% if tags.maxspeed is not defined %}",
"{% set maxspeedKmh = null %}",
"{% set maxspeed = null %}",
"{% set unit = null %}",
"{% else %}",
"",
"{% if tags.maxspeed|matches(\"^[0-9]+$\") %}",
"{% set maxspeedKmh = tags.maxspeed %}",
"{% set maxspeed = tags.maxspeed %}",
"{% set unit = \"km/h\" %}",
"{% endif %}",
"",
"",
"{% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}",
"{% if m %}",
"{% set maxspeedKmh = m[1] * 1.60934 %}",
"{% set maxspeed = m[1] %}",
"{% set unit = \"mph\" %}",
"{% endif %}",
"",
"{% endif %}",
"",
"{% if not maxspeedKmh %}",
"{% set color = \"#404040\" %}",
"{% else %}",
"{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
"{% endif %}"
],
"description": [
"{% if maxspeed %}",
"<span style='color: {{ color }}'>{{ maxspeed }} {{ unit }}</span>",
"{% elseif tags.maxspeed %}",
"{{ tags.maxspeed }}",
"{% else %}",
"{{ trans('unknown') }}",
"{% endif %}"
],
"markerSymbol": null,
"listMarkerSymbol": "line",
"style": {
"width": "3",
"color": "{{ color }}"
}
},
"const": {
"colorMap": [
"#00af00",
"#ff7f00",
"#ff0000",
"#af00af"
],
"highestColorSpeed": 300,
"offsetColorSpeed": 20
},
"info": [
"<div style='display: inline-block'>",
"<table>",
" <tr>",
" <td>{{ markerLine(evaluate({}))|raw }}</td>",
" <td colspan>{{ trans('unknown') }}</td>",
" </tr>",
"{% for i in range(25, 280, 25) %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}</td>",
" <td>{{ i }}km/h</td>",
" </tr>",
"{% endfor %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": 300 }))|raw }}</td>",
" <td>≥300km/h</td>",
" </tr>",
"</table>",
"</div>",
"",
"<div style='display: inline-block'>",
"<table>",
" <tr>",
" <td>{{ markerLine(evaluate({}))|raw }}</td>",
" <td colspan>{{ trans('unknown') }}</td>",
" </tr>",
"{% for i in range(15, 150, 15) %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}</td>",
" <td>{{ i }}mph</td>",
" </tr>",
"{% endfor %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": (175 * 1.60934)|round }))|raw }}</td>",
" <td>175mph</td>",
" </tr>",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": (200 * 1.60934)|round }))|raw }}</td>",
" <td>≥200mph</td>",
" </tr>",
"</table>",
"</div>"
]
}
Loading…
Cancel
Save