diff --git a/railway-maxspeed.json b/railway-maxspeed.json
index 10fb8a45..1c756f21 100644
--- a/railway-maxspeed.json
+++ b/railway-maxspeed.json
@@ -14,36 +14,67 @@
},
"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\" %}",
+ "{% if tags.maxspeed is defined %}",
+ " {% if tags.maxspeed|matches(\"^[0-9]+$\") %}",
+ " {% set maxspeedKmh = tags.maxspeed %}",
+ " {% set maxspeed = tags.maxspeed %}",
+ " {% set unit = \"km/h\" %}",
+ " {% elseif tags.maxspeed|matches( \"(^[0-9]+) mph$\") %}",
+ " {% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}",
+ " {% set maxspeedKmh = m[1] * 1.60934 %}",
+ " {% set maxspeed = m[1] %}",
+ " {% set unit = \"mph\" %}",
+ " {% endif %}",
"{% endif %}",
"",
- "",
- "{% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}",
- "{% if m %}",
- "{% set maxspeedKmh = m[1] * 1.60934 %}",
- "{% set maxspeed = m[1] %}",
- "{% set unit = \"mph\" %}",
+ "{% if attribute(tags, 'maxspeed:forward') is defined %}",
+ " {% if attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+$\") %}",
+ " {% set maxspeedFKmh = attribute(tags, 'maxspeed:forward') %}",
+ " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}",
+ " {% set unit = \"km/h\" %}",
+ " {% elseif attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+ mph$\") %}",
+ " {% set m = attribute(tags, 'maxspeed:forward')|matches(\"(^[0-9]+) mph$\") %}",
+ " {% set maxspeedFKmh = m[1] * 1.60934 %}",
+ " {% set maxspeedF = m[1] %}",
+ " {% set unit = \"mph\" %}",
+ " {% endif %}",
"{% endif %}",
"",
+ "{% if attribute(tags, 'maxspeed:backward') is defined %}",
+ " {% if attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+$\") %}",
+ " {% set maxspeedBKmh = attribute(tags, 'maxspeed:backward') %}",
+ " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}",
+ " {% set unit = \"km/h\" %}",
+ " {% elseif attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+ mph$\") %}",
+ " {% set m = attribute(tags, 'maxspeed:backward')|matches(\"(^[0-9]+) mph$\") %}",
+ " {% set maxspeedBKmh = m[1] * 1.60934 %}",
+ " {% set maxspeedB = 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 %}",
+ "",
+ "{% if maxspeedFKmh %}",
+ "{% set colorF = colorInterpolate(const.colorMap, (maxspeedFKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
+ "{% endif %}",
+ "",
+ "{% if maxspeedBKmh %}",
+ "{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
"{% endif %}"
],
"description": [
- "{% if maxspeed %}",
+ "{% if maxspeedF or maxspeedB %}",
+ "{{ maxspeedB|default(trans('unknown')) }} / {{ maxspeedF|default(trans('unknown')) }} {{ unit }}",
+ "{% elseif maxspeed %}",
"{{ maxspeed }} {{ unit }}",
"{% elseif tags.maxspeed %}",
"{{ tags.maxspeed }}",
@@ -53,12 +84,30 @@
],
"markerSymbol": null,
"listMarkerSymbol": "line",
+ "styles": "{% if maxspeedB or maxspeedF %}left,right,default{% else %}default{% endif %}",
"style": {
- "width": "3",
+ "width": "{% if maxspeedB or maxspeedF %}0{% else %}4{% endif %}",
"color": "{{ color }}",
- "text": "{{ maxspeed }} ",
+ "text": [
+ "{% if maxspeedB or maxspeedF %}",
+ " {% if maxspeedB %}🡸 {{ maxspeedB }} {% endif %}|{% if maxspeedF %} {{ maxspeedF }} 🡺{% endif %} ",
+ "{% else %}",
+ " {{ maxspeed }} ",
+ "{% endif %}"
+ ],
"textRepeat": "1",
+ "textOffset": "4",
"textFontWeight": "bold"
+ },
+ "style:left": {
+ "width": "2",
+ "color": "{{ colorB|default('#404040') }}",
+ "offset": "-1"
+ },
+ "style:right": {
+ "width": "2",
+ "color": "{{ colorF|default('#404040') }}",
+ "offset": "1"
}
},
"const": {