From 610264ed648bfa3e1292168d5cffd21f0ce33a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 5 Jan 2020 14:09:57 +0100 Subject: [PATCH 1/3] railway-gauge: thicker lines (2,5m or min. 3px) --- railway-gauge.json | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/railway-gauge.json b/railway-gauge.json index e20de61..c7c2fc2 100644 --- a/railway-gauge.json +++ b/railway-gauge.json @@ -8,8 +8,11 @@ "14": "way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$'];" }, "feature": { - "pre": "{% set gauges = tags.gauge|split(';') %}", - "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", + "pre": [ + "{% set gauges = tags.gauge|split(';') %}", + "{% set width = max(3, 2.5 / map.metersPerPixel) %}" + ], + "title": "{{ width }}{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", "description": "{{ tags.gauge|default(trans('unknown'))|enumerate }}", "body": [ "{{ tagTrans('railway', tags.railway) }}
", @@ -23,31 +26,36 @@ "listMarkerSymbol": "line", "styles": "{% if gauges|length < 2 %}default{% else %}{% for i, v in gauges %}{% if i != 0 %},{% endif %}gauge{{ i }}{% endfor %}{% endif %}", "style": { - "width": "3", + "width": "{{ width }}", + "pane": "casing", "color": "{% if tags.gauge %}{% if not tags.gauge|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], tags.gauge / 2000) }}{% endif %}{% else %}#404040{% endif %}" }, "style:gauge0": { - "width": "3", + "width": "{{ width }}", + "pane": "casing", "lineCap": "butt", "color": "{% if not gauges[0]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[0] / 2000) }}{% endif %}", "dashArray": "5,{{ (gauges|length - 1) * 5 }}" }, "style:gauge1": { - "width": "3", + "width": "{{ width }}", + "pane": "casing", "lineCap": "butt", "color": "{% if not gauges[1]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[1] / 2000) }}{% endif %}", "dashArray": "5,{{ (gauges|length - 1) * 5 }}", "dashOffset": "5" }, "style:gauge2": { - "width": "3", + "width": "{{ width }}", + "pane": "casing", "lineCap": "butt", "color": "{% if not gauges[2]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[2] / 2000) }}{% endif %}", "dashArray": "5,{{ (gauges|length - 1) * 5 }}", "dashOffset": "10" }, "style:gauge3": { - "width": "3", + "width": "{{ width }}", + "pane": "casing", "lineCap": "butt", "color": "{% if not gauges[3]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[3] / 2000) }}{% endif %}", "dashArray": "5,{{ (gauges|length - 1) * 5 }}", From 5ed8a991aa49489d2058abaea757ef846dd1674c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 5 Jan 2020 20:37:38 +0100 Subject: [PATCH 2/3] railway-gauge: from z18 show rails --- railway-gauge.json | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/railway-gauge.json b/railway-gauge.json index c7c2fc2..a7639a2 100644 --- a/railway-gauge.json +++ b/railway-gauge.json @@ -12,7 +12,7 @@ "{% set gauges = tags.gauge|split(';') %}", "{% set width = max(3, 2.5 / map.metersPerPixel) %}" ], - "title": "{{ width }}{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", + "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", "description": "{{ tags.gauge|default(trans('unknown'))|enumerate }}", "body": [ "{{ tagTrans('railway', tags.railway) }}
", @@ -24,12 +24,17 @@ ], "markerSymbol": null, "listMarkerSymbol": "line", - "styles": "{% if gauges|length < 2 %}default{% else %}{% for i, v in gauges %}{% if i != 0 %},{% endif %}gauge{{ i }}{% endfor %}{% endif %}", + "styles": "{% if gauges|length < 2 %}default{% else %}{% for i, v in gauges %}{% if i != 0 %},{% endif %}gauge{{ i }}{% endfor %}{% endif %}{% if map.zoom >= 18 %},rail{% for i, v in gauges %},rail{{ i }}{% endfor %}{% endif %}", "style": { "width": "{{ width }}", "pane": "casing", "color": "{% if tags.gauge %}{% if not tags.gauge|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], tags.gauge / 2000) }}{% endif %}{% else %}#404040{% endif %}" }, + "style:rail": { + "width": "1", + "color": "#000000", + "offset": "{{ gauges[0] / -2000 }}m" + }, "style:gauge0": { "width": "{{ width }}", "pane": "casing", @@ -37,6 +42,11 @@ "color": "{% if not gauges[0]|matches('^[0-9]+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[0] / 2000) }}{% endif %}", "dashArray": "5,{{ (gauges|length - 1) * 5 }}" }, + "style:rail0": { + "width": "1", + "color": "#000000", + "offset": "{{ gauges[0] / 2000 }}m" + }, "style:gauge1": { "width": "{{ width }}", "pane": "casing", @@ -45,6 +55,11 @@ "dashArray": "5,{{ (gauges|length - 1) * 5 }}", "dashOffset": "5" }, + "style:rail1": { + "width": "1", + "color": "#000000", + "offset": "{{ gauges[0] / -2000 + gauges[1] / 1000 }}m" + }, "style:gauge2": { "width": "{{ width }}", "pane": "casing", @@ -53,6 +68,11 @@ "dashArray": "5,{{ (gauges|length - 1) * 5 }}", "dashOffset": "10" }, + "style:rail2": { + "width": "1", + "color": "#000000", + "offset": "{{ gauges[0] / -2000 + gauges[2] / 1000 }}m" + }, "style:gauge3": { "width": "{{ width }}", "pane": "casing", @@ -60,6 +80,11 @@ "color": "{% if not gauges[3]|matches('^\\d+$') %}#ff0000{% else %}{{ colorInterpolate([ '#00ff00', '#0000ff' ], gauges[3] / 2000) }}{% endif %}", "dashArray": "5,{{ (gauges|length - 1) * 5 }}", "dashOffset": "15" + }, + "style:rail3": { + "width": "1", + "color": "#000000", + "offset": "{{ gauges[0] / -2000 + gauges[3] / 1000 }}m" } }, "info": [ From 9721e58c02a27d7cfb146731e504b5b58cff149d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sun, 26 Jan 2020 14:01:51 +0100 Subject: [PATCH 3/3] railway-gauge: rails in white, other improvements --- railway-gauge.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/railway-gauge.json b/railway-gauge.json index a7639a2..4771b27 100644 --- a/railway-gauge.json +++ b/railway-gauge.json @@ -9,8 +9,8 @@ }, "feature": { "pre": [ - "{% set gauges = tags.gauge|split(';') %}", - "{% set width = max(3, 2.5 / map.metersPerPixel) %}" + "{% set gauges = tags.gauge|split(';')|sort|reverse %}", + "{% set width = max(3, 3 / map.metersPerPixel) %}" ], "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator'))|default(trans('unnamed')) }}", "description": "{{ tags.gauge|default(trans('unknown'))|enumerate }}", @@ -24,7 +24,7 @@ ], "markerSymbol": null, "listMarkerSymbol": "line", - "styles": "{% if gauges|length < 2 %}default{% else %}{% for i, v in gauges %}{% if i != 0 %},{% endif %}gauge{{ i }}{% endfor %}{% endif %}{% if map.zoom >= 18 %},rail{% for i, v in gauges %},rail{{ i }}{% endfor %}{% endif %}", + "styles": "{% if gauges|length < 2 %}default{% else %}{% for i, v in gauges %}{% if i != 0 %},{% endif %}gauge{{ i }}{% endfor %}{% endif %}{% if gauges|length > 0 and map.zoom >= 18 %},rail{% for i, v in gauges %},rail{{ i }}{% endfor %}{% endif %}", "style": { "width": "{{ width }}", "pane": "casing", @@ -32,7 +32,7 @@ }, "style:rail": { "width": "1", - "color": "#000000", + "color": "#ffffff", "offset": "{{ gauges[0] / -2000 }}m" }, "style:gauge0": { @@ -44,7 +44,7 @@ }, "style:rail0": { "width": "1", - "color": "#000000", + "color": "#ffffff", "offset": "{{ gauges[0] / 2000 }}m" }, "style:gauge1": { @@ -57,7 +57,7 @@ }, "style:rail1": { "width": "1", - "color": "#000000", + "color": "#ffffff", "offset": "{{ gauges[0] / -2000 + gauges[1] / 1000 }}m" }, "style:gauge2": { @@ -70,7 +70,7 @@ }, "style:rail2": { "width": "1", - "color": "#000000", + "color": "#ffffff", "offset": "{{ gauges[0] / -2000 + gauges[2] / 1000 }}m" }, "style:gauge3": { @@ -83,7 +83,7 @@ }, "style:rail3": { "width": "1", - "color": "#000000", + "color": "#ffffff", "offset": "{{ gauges[0] / -2000 + gauges[3] / 1000 }}m" } },