From f6b8774fe88a8289a4756ec6cdc49f0d2774273b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Tue, 24 Sep 2024 21:47:12 +0200 Subject: [PATCH] Convert railway categories to YAML --- railway-electrification.json | 165 -------------------------------- railway-electrification.yaml | 149 +++++++++++++++++++++++++++++ railway-gauge.json | 132 -------------------------- railway-gauge.yaml | 114 ++++++++++++++++++++++ railway-infrastructure.json | 169 --------------------------------- railway-infrastructure.yaml | 152 ++++++++++++++++++++++++++++++ railway-maxspeed.json | 178 ----------------------------------- railway-maxspeed.yaml | 164 ++++++++++++++++++++++++++++++++ railway-routes.json | 75 --------------- railway-routes.yaml | 66 +++++++++++++ 10 files changed, 645 insertions(+), 719 deletions(-) delete mode 100644 railway-electrification.json create mode 100644 railway-electrification.yaml delete mode 100644 railway-gauge.json create mode 100644 railway-gauge.yaml delete mode 100644 railway-infrastructure.json create mode 100644 railway-infrastructure.yaml delete mode 100644 railway-maxspeed.json create mode 100644 railway-maxspeed.yaml delete mode 100644 railway-routes.json create mode 100644 railway-routes.yaml diff --git a/railway-electrification.json b/railway-electrification.json deleted file mode 100644 index 73ecbf8..0000000 --- a/railway-electrification.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "type": "overpass", - "name": { - "ca": "Electrificació de la via fèrria", - "cs": "Elektrifikovaná železnice", - "de": "Eisenbahn Elektrifizierung", - "en": "Railway electrification", - "es": "Electrificación ferroviaria", - "fr": "Puissance électrique ferroviaire", - "gl": "Ferrocarril electrificado", - "hu": "Vasút villamosítottsága", - "it": "Elettrificazione ferroviaria", - "ja": "鉄道の電力", - "nb": "Jernbane-strømtilførsel", - "nl": "Spoorwegelektrificatie", - "oc": "Electrificacion ferroviària", - "pl": "Elektryfikacja kolei", - "pt": "Eletrificação ferroviária", - "pt-br": "Eletrificação ferroviária", - "ru": "Электрификация железных дорог", - "tr": "Demiryolu elektrifikasyonu" - }, - "query": { - "11": "way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$'];", - "14": "way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$'];" - }, - "feature": { - "pre": [ - "{% if tags.electrified and tags.electrified != 'no' %}", - " {% if not tags.voltage is defined %}", - " {% set color = const.colorUnknown %}", - " {% elseif not tags.voltage|matches('^[0-9]+$') %}", - " {% set color = const.colorIllegal %}", - " {% elseif tags.voltage < const.range[1] %}", - " {% set color = colorInterpolate(const.scheme|slice(0, 2), tags.voltage / const.range[1]) %}", - " {% else %}", - " {% set color = colorInterpolate(const.scheme|slice(1, 2), (tags.voltage - const.range[1]) / (const.range[2] - const.range[1])) %}", - " {% endif %}", - "{% elseif tags.electrified and tags.electrified == 'no' %}", - " {% set color = const.colorNone %}", - "{% else %}", - " {% set color = const.colorUnknown %}", - "{% endif %}", - "", - "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}", - " {% set width=2 %}", - " {% else %}", - " {% if tags.railway == 'rail' %}", - " {% if tags.usage == 'main' or tags.usage == 'branch' %}", - " {% set width=4 %}", - " {% else %}", - " {% set width=3 %}", - " {% endif %}", - " {% else %}", - " {% set width=2 %}", - " {% endif %}", - "{% endif %}" - ], - "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}", - "description": "{{ tagTrans('railway', tags.railway) }}", - "details": [ - "{% if tags.electrified == 'no' %}", - "{{ tagTrans('electrified', 'no') }}", - "{% elseif tags.electrified %}", - "{{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz", - "{% endif %}" - ], - "body": [ - "{{ tagTrans('railway', tags.railway) }}
", - "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}", - "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}
{% endif %}", - "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}
{% endif %}", - "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}
", - "{% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %}" - ], - "markerSymbol": null, - "listMarkerSymbol": "line", - "styles": "casing,default", - "priority": "{% if tags.railway == 'station' %}0{% elseif tags.railway in [ 'halt', 'tram_stop' ] %}1{% else %}5{% endif %}", - "style": { - "width": "{{ width }}", - "lineCap": "butt", - "color": "{{ color }}", - "opacity": "1", - "fill": null, - "dashArray": [ - "{% if not tags.electrified is defined %}", - "{% elseif not tags.frequency is defined or tags.frequency == 0 %}", - "{% else %}", - "5,2", - "{% endif %}" - ] - }, - "style:casing": { - "width": "{{ width }}", - "color": "white", - "opacity": "1", - "lineCap": "butt", - "fill": null - } - }, - "info": [ - "", - " ", - " ", - " ", - " ", - "{% for i in range(0, const.range[1], const.infoSteps[0]) %}", - " {% set color = colorInterpolate(const.scheme|slice(0, 2), i / const.range[1]) %}", - " ", - " ", - " ", - " ", - "{% endfor %}", - "", - "{% for i in range(const.range[1] + const.infoSteps[1], const.range[2], const.infoSteps[1]) %}", - " {% set color = colorInterpolate(const.scheme|slice(1, 2), (i - const.range[1]) / (const.range[2] - const.range[1])) %}", - " ", - " ", - " ", - " ", - "{% endfor %}", - "", - "{% set color = const.scheme[1] %}", - " ", - " ", - " ", - " ", - "", - " ", - " ", - " ", - " ", - "", - " ", - " ", - " ", - " ", - "", - " ", - " ", - " ", - " ", - "
{{ markerLine({ 'width': 3, 'color': const.colorNone })|raw }}{{ trans('not electrified') }}
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ i }}V
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ i }}V
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ trans('tag:frequency=0') }}
{{ markerLine({ 'styles': [ 'casing', 'default' ], 'style:casing': { 'width': 3, 'color': 'white' }, 'style': { 'width': '3', 'dashArray': '5,2', 'lineCap': 'butt', 'color': color } })|raw }}{{ trans('tag:frequency>0') }}
{{ markerLine({ 'width': 3, 'color': const.colorUnknown })|raw }}{{ trans('unknown') }}
{{ markerLine({ 'width': 3, 'color': const.colorIllegal })|raw }}{{ trans('illegal value') }}
" - ], - "const": { - "range": [ - 0, - 1000, - 25000 - ], - "infoSteps": [ - 200, - 2000 - ], - "scheme": [ - "#00ff00", - "#003fff", - "#af0000" - ], - "colorNone": "orange", - "colorUnknown": "#404040", - "colorIllegal": "#ff0000" - } -} diff --git a/railway-electrification.yaml b/railway-electrification.yaml new file mode 100644 index 0000000..f5fd703 --- /dev/null +++ b/railway-electrification.yaml @@ -0,0 +1,149 @@ +type: overpass +name: + ca: Electrificació de la via fèrria + cs: Elektrifikovaná železnice + de: Eisenbahn Elektrifizierung + en: Railway electrification + es: Electrificación ferroviaria + fr: Puissance électrique ferroviaire + gl: Ferrocarril electrificado + hu: Vasút villamosítottsága + it: Elettrificazione ferroviaria + ja: 鉄道の電力 + nb: Jernbane-strømtilførsel + nl: Spoorwegelektrificatie + oc: Electrificacion ferroviària + pl: Elektryfikacja kolei + pt: Eletrificação ferroviária + pt-br: Eletrificação ferroviária + ru: Электрификация железных дорог + tr: Demiryolu elektrifikasyonu +query: + 11: way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$']; + 14: way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$']; +feature: + pre: |- + {% if tags.electrified and tags.electrified != 'no' %} + {% if not tags.voltage is defined %} + {% set color = const.colorUnknown %} + {% elseif not tags.voltage|matches('^[0-9]+$') %} + {% set color = const.colorIllegal %} + {% elseif tags.voltage < const.range[1] %} + {% set color = colorInterpolate(const.scheme|slice(0, 2), tags.voltage / const.range[1]) %} + {% else %} + {% set color = colorInterpolate(const.scheme|slice(1, 2), (tags.voltage - const.range[1]) / (const.range[2] - const.range[1])) %} + {% endif %} + {% elseif tags.electrified and tags.electrified == 'no' %} + {% set color = const.colorNone %} + {% else %} + {% set color = const.colorUnknown %} + {% endif %} + + {% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %} + {% set width=2 %} + {% else %} + {% if tags.railway == 'rail' %} + {% if tags.usage == 'main' or tags.usage == 'branch' %} + {% set width=4 %} + {% else %} + {% set width=3 %} + {% endif %} + {% else %} + {% set width=2 %} + {% endif %} + {% endif %} + title: '{% if tags.ref %}{{ localizedTag(tags, ''ref'') }} - {% endif %}{{ localizedTag(tags, ''name'')|default(localizedTag(tags, ''operator'')) }}' + description: '{{ tagTrans(''railway'', tags.railway) }}' + details: |- + {% if tags.electrified == 'no' %} + {{ tagTrans('electrified', 'no') }} + {% elseif tags.electrified %} + {{ tags.voltage|default(trans('unknown')) }}V, {{ tags.frequency|default(trans('unknown')) }}Hz + {% endif %} + body: |- + {{ tagTrans('railway', tags.railway) }}
+ {% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %} + {% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}
{% endif %} + {% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}
{% endif %} + {{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}
+ {% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %} + markerSymbol: null + listMarkerSymbol: line + styles: casing,default + priority: '{% if tags.railway == ''station'' %}0{% elseif tags.railway in [ ''halt'', ''tram_stop'' ] %}1{% else %}5{% endif %}' + style: + width: '{{ width }}' + lineCap: butt + color: '{{ color }}' + opacity: '1' + fill: null + dashArray: |- + {% if not tags.electrified is defined %} + {% elseif not tags.frequency is defined or tags.frequency == 0 %} + {% else %} + 5,2 + {% endif %} + style:casing: + width: '{{ width }}' + color: white + opacity: '1' + lineCap: butt + fill: null +info: |- + + + + + + {% for i in range(0, const.range[1], const.infoSteps[0]) %} + {% set color = colorInterpolate(const.scheme|slice(0, 2), i / const.range[1]) %} + + + + + {% endfor %} + + {% for i in range(const.range[1] + const.infoSteps[1], const.range[2], const.infoSteps[1]) %} + {% set color = colorInterpolate(const.scheme|slice(1, 2), (i - const.range[1]) / (const.range[2] - const.range[1])) %} + + + + + {% endfor %} + + {% set color = const.scheme[1] %} + + + + + + + + + + + + + + + + + + + +
{{ markerLine({ 'width': 3, 'color': const.colorNone })|raw }}{{ trans('not electrified') }}
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ i }}V
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ i }}V
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ trans('tag:frequency=0') }}
{{ markerLine({ 'styles': [ 'casing', 'default' ], 'style:casing': { 'width': 3, 'color': 'white' }, 'style': { 'width': '3', 'dashArray': '5,2', 'lineCap': 'butt', 'color': color } })|raw }}{{ trans('tag:frequency>0') }}
{{ markerLine({ 'width': 3, 'color': const.colorUnknown })|raw }}{{ trans('unknown') }}
{{ markerLine({ 'width': 3, 'color': const.colorIllegal })|raw }}{{ trans('illegal value') }}
+const: + range: + - 0 + - 1000 + - 25000 + infoSteps: + - 200 + - 2000 + scheme: + - '#00ff00' + - '#003fff' + - '#af0000' + colorNone: orange + colorUnknown: '#404040' + colorIllegal: '#ff0000' diff --git a/railway-gauge.json b/railway-gauge.json deleted file mode 100644 index 4c7e286..0000000 --- a/railway-gauge.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "type": "overpass", - "name": { - "ca": "Ample de via fèrria", - "cs": "Rozchod železnice", - "de": "Eisenbahn-Spurweite", - "en": "Railway gauge", - "es": "Ancho de vía", - "fr": "Écartement des rails", - "gl": "Anchura de vía", - "hu": "Vasúti nyomtáv", - "it": "Scartamento Ferroviario", - "ja": "軌間", - "nb": "Sporvidde", - "oc": "Ample dei vias", - "pl": "Rozstaw szyn", - "pt": "Bitola", - "pt-br": "Bitola", - "ru": "Железнодорожная колея", - "tr": "Demiryolu hat açıklığı" - }, - "query": { - "11": "way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$'];", - "14": "way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$'];" - }, - "feature": { - "pre": [ - "{% 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')) }}", - "description": "{{ tagTrans('railway', tags.railway) }}", - "details": "{{ tags.gauge|default(trans('unknown'))|enumerate }}", - "body": [ - "{{ tagTrans('railway', tags.railway) }}
", - "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}", - "{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}
{% endif %}", - "{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}
{% endif %}", - "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown'))|enumerate }}
", - "{% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %}" - ], - "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 gauges|length > 0 and 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": "#ffffff", - "offset": "{{ gauges[0] / -2000 }}m" - }, - "style:gauge0": { - "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:rail0": { - "width": "1", - "color": "#ffffff", - "offset": "{{ gauges[0] / 2000 }}m" - }, - "style:gauge1": { - "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:rail1": { - "width": "1", - "color": "#ffffff", - "offset": "{{ gauges[0] / -2000 + gauges[1] / 1000 }}m" - }, - "style:gauge2": { - "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:rail2": { - "width": "1", - "color": "#ffffff", - "offset": "{{ gauges[0] / -2000 + gauges[2] / 1000 }}m" - }, - "style:gauge3": { - "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 }}", - "dashOffset": "15" - }, - "style:rail3": { - "width": "1", - "color": "#ffffff", - "offset": "{{ gauges[0] / -2000 + gauges[3] / 1000 }}m" - } - }, - "info": [ - "", - " {% set color = '#ff0000' %}", - " ", - " ", - " ", - " ", - " {% set color = '#404040' %}", - " ", - " ", - " ", - " ", - "{% for i in range(0, 1800, 250) %}", - " {% set color = colorInterpolate([ '#00ff00', '#0000ff' ], i / 2000) %}", - " ", - " ", - " ", - " ", - "{% endfor %}", - " ", - " ", - " ", - " ", - "
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ trans('illegal value') }}
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ trans('unknown') }}
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ i }}mm
{{ markerLine({ 'width': 3, 'color': '#0000ff' })|raw }}>2000mm
" - ] -} diff --git a/railway-gauge.yaml b/railway-gauge.yaml new file mode 100644 index 0000000..843ae10 --- /dev/null +++ b/railway-gauge.yaml @@ -0,0 +1,114 @@ +type: overpass +name: + ca: Ample de via fèrria + cs: Rozchod železnice + de: Eisenbahn-Spurweite + en: Railway gauge + es: Ancho de vía + fr: Écartement des rails + gl: Anchura de vía + hu: Vasúti nyomtáv + it: Scartamento Ferroviario + ja: 軌間 + nb: Sporvidde + oc: Ample dei vias + pl: Rozstaw szyn + pt: Bitola + pt-br: Bitola + ru: Железнодорожная колея + tr: Demiryolu hat açıklığı +query: + 11: way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$']; + 14: way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$']; +feature: + pre: |- + {% 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'')) }}' + description: '{{ tagTrans(''railway'', tags.railway) }}' + details: '{{ tags.gauge|default(trans(''unknown''))|enumerate }}' + body: |- + {{ tagTrans('railway', tags.railway) }}
+ {% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %} + {% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}
{% endif %} + {% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}
{% endif %} + {{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown'))|enumerate }}
+ {% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %} + 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 gauges|length > 0 and 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: '#ffffff' + offset: '{{ gauges[0] / -2000 }}m' + style:gauge0: + 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:rail0: + width: '1' + color: '#ffffff' + offset: '{{ gauges[0] / 2000 }}m' + style:gauge1: + 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:rail1: + width: '1' + color: '#ffffff' + offset: '{{ gauges[0] / -2000 + gauges[1] / 1000 }}m' + style:gauge2: + 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:rail2: + width: '1' + color: '#ffffff' + offset: '{{ gauges[0] / -2000 + gauges[2] / 1000 }}m' + style:gauge3: + 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 }}' + dashOffset: '15' + style:rail3: + width: '1' + color: '#ffffff' + offset: '{{ gauges[0] / -2000 + gauges[3] / 1000 }}m' +info: |- + + {% set color = '#ff0000' %} + + + + + {% set color = '#404040' %} + + + + + {% for i in range(0, 1800, 250) %} + {% set color = colorInterpolate([ '#00ff00', '#0000ff' ], i / 2000) %} + + + + + {% endfor %} + + + + +
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ trans('illegal value') }}
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ trans('unknown') }}
{{ markerLine({ 'width': 3, 'color': color })|raw }}{{ i }}mm
{{ markerLine({ 'width': 3, 'color': '#0000ff' })|raw }}>2000mm
diff --git a/railway-infrastructure.json b/railway-infrastructure.json deleted file mode 100644 index c1a4a05..0000000 --- a/railway-infrastructure.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "type": "overpass", - "name": { - "ca": "Infraestructura fèrria", - "cs": "Železniční infrastruktura", - "de": "Eisenbahn Infrastruktur", - "en": "Railway infrastructure", - "es": "Infraestructura ferroviaria", - "fr": "Infrastructure ferroviaire", - "gl": "Infraestrutura do ferrocarril", - "hu": "Vasúti infrastruktúra", - "it": "Infrastruttura ferroviaria", - "ja": "鉄道インフラ", - "nb": "Jernbane-infrastruktur", - "nl": "Spoorweginfrastructuur", - "oc": "Infrastructura ferroviària", - "pl": "Infrastruktura kolejowa", - "pt": "Infraestrutura ferroviária", - "pt-br": "Infraestrutura ferroviária", - "ru": "Железнодорожная инфраструктура", - "sr": "Железничка инфраструктура", - "tr": "Demiryolu altyapısı" - }, - "query": { - "11": "(way[railway=rail][usage~'^(main|branch)$'];node[railway~'^(station)$'];)", - "14": "(way[railway];node[railway~'^(station|halt|tram_stop)$'];)", - "17": "(node[railway];way[railway];)" - }, - "feature": { - "title": "{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}", - "description": [ - "{{ tagTrans('railway', tags.railway) -}}", - "{%- if tags.usage %}", - ", {{ tagTrans('railway=rail usage', tags.usage) }}", - "{% endif -%}", - "{%- if tags.service %}", - ", {{ tagTrans('railway=rail service', tags.service) }}", - "{% endif -%}" - ], - "body": [ - "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}", - "{% if tags.usage %}{{ keyTrans('railway=rail usage') }}: {{ tagTrans('railway=rail usage', tags.usage)|default(trans('unknown')) }}
{% endif %}", - "{% if tags.service %}{{ keyTrans('railway=rail service') }}: {{ tagTrans('railway=rail service', tags.service ) }}
{% endif %}", - "{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}
", - "{% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %}" - ], - "markerSign": "{% if tags.railway in [ 'halt', 'tram_stop', 'station', 'stop', 'subway_entrance' ] %}X{% endif %}", - "markerSymbol": [ - "{% if tags.railway == 'signal' %}", - "", - " ", - " ", - " ", - "", - "{% elseif tags.railway == 'switch' %}", - "", - " ", - " ", - " ", - "", - "{% elseif tags.railway == 'railway_crossing' %}", - "", - " ", - " ", - " ", - "", - "{% elseif tags.railway not in [ 'rail', 'tram', 'subway', 'narrow_gauge', 'abandoned', 'disused' ] %}", - "{{ markerPointer({})|raw }}", - "{% endif %}" - ], - "listMarkerSymbol": [ - "{% if tags.railway in [ 'station', 'halt', 'tram_stop', 'stop', 'subway_entrance', 'signal', 'switch', 'railway_crossing' ] %}", - "{% else %}", - "line", - "{% endif %}" - ], - "priority": [ - "{% if tags.railway == 'station' %}0", - "{% elseif tags.railway in [ 'halt' ] %}1", - "{% elseif tags.railway in [ 'tram_stop', 'stop' ] %}2", - "{% elseif tags.railway in [ 'subway_entrance' ] %}3", - "{% else %}5", - "{% endif %}" - ], - "styles": "{% if tags.railway == 'narrow_gauge' %}default,casing{% else %}default{% endif %}", - "style": { - "width": [ - "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}", - "1", - "{% else %}", - " {% if tags.railway == 'rail' %}", - " {% if tags.usage == 'main' or tags.usage == 'branch' %}", - " 3", - " {% else %}", - " 2", - " {% endif %}", - " {% elseif tags.railway == 'platform' %}", - " 1", - " {% elseif tags.railway in [ 'signal', 'switch', 'railway_crossing' ] %}", - " 0", - " {% else %}", - " 2", - " {% endif %}", - "{% endif %}" - ], - "color": "{% if tags.railway == 'rail' or tags.railway == 'narrow_gauge' or tags.railway == 'disused' %}{% if tags.usage == 'main' %}#ff8100{% elseif tags.usage == 'branch' %}#daca00{% else %}#000000{% endif %}{% elseif tags.railway == 'subway' %}#0000ff{% elseif tags.railway == 'tram' %}#ff00ff{% elseif tags.railway == 'light_rail' %}#00BD14{% elseif tags.railway == 'platform' %}#3f3f3f{% else %}#000000{% endif %}", - "opacity": "1", - "dashArray": "{% if tags.railway == 'rail' %}{% elseif tags.railway == 'disused' %}1,5{% elseif tags.railway == 'abandoned' %}1,7{% endif %}", - "fill": [ - "{% if tags.railway == 'platform' %}", - "1", - "{% elseif type == 'node' %}", - "1", - "{% else %}", - "{% endif %}" - ], - "fillColor": [ - "{% if tags.railway == 'platform' %}", - "#3f3f3f", - "{% elseif type == 'node' %}", - "#ffffff", - "{% endif %}" - ], - "fillOpacity": [ - "{% if tags.railway == 'platform' %}", - "0.2", - "{% elseif type == 'node' %}", - "0", - "{% endif %}" - ] - }, - "style:casing": { - "width": "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}5{% else %}{% if tags.railway == 'rail' %}{% if tags.usage == 'main' or tags.usage == 'branch' %}7{% else %}6{% endif %}{% elseif tags.railway == 'platform' %}5{% else %}6{% endif %}{% endif %}", - "color": "{% if tags.railway == 'rail' or tags.railway == 'narrow_gauge' or tags.railway == 'disused' %}{% if tags.usage == 'main' %}#ff8100{% elseif tags.usage == 'branch' %}#daca00{% else %}#000000{% endif %}{% elseif tags.railway == 'subway' %}#0000ff{% elseif tags.railway == 'tram' %}#ff00ff{% elseif tags.railway == 'light_rail' %}#00BD14{% elseif tags.railway == 'platform' %}#3f3f3f{% else %}#000000{% endif %}", - "lineCap": "butt", - "dashArray": "2,4" - } - }, - "info": [ - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "{% if map.zoom >= 14 %}", - " ", - " ", - " ", - " ", - "{% endif %}", - "
{{ markerLine(evaluate({ \"railway\": \"rail\", \"usage\": \"main\" }))|raw }}{{ tagTrans('railway', 'rail') }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', 'main') }}
{{ markerLine(evaluate({ \"railway\": \"rail\" }))|raw }}{{ tagTrans('railway', 'rail') }}
{{ markerLine(evaluate({ \"railway\": \"narrow_gauge\" }))|raw }}{{ tagTrans('railway', 'narrow_gauge') }}
{{ markerLine(evaluate({ \"railway\": \"light_rail\" }))|raw }}{{ tagTrans('railway', 'light_rail') }}
{{ markerLine(evaluate({ \"railway\": \"subway\" }))|raw }}{{ tagTrans('railway', 'subway') }}
{{ markerLine(evaluate({ \"railway\": \"tram\" }))|raw }}{{ tagTrans('railway', 'tram') }}
" - ] -} diff --git a/railway-infrastructure.yaml b/railway-infrastructure.yaml new file mode 100644 index 0000000..f0846a5 --- /dev/null +++ b/railway-infrastructure.yaml @@ -0,0 +1,152 @@ +type: overpass +name: + ca: Infraestructura fèrria + cs: Železniční infrastruktura + de: Eisenbahn Infrastruktur + en: Railway infrastructure + es: Infraestructura ferroviaria + fr: Infrastructure ferroviaire + gl: Infraestrutura do ferrocarril + hu: Vasúti infrastruktúra + it: Infrastruttura ferroviaria + ja: 鉄道インフラ + nb: Jernbane-infrastruktur + nl: Spoorweginfrastructuur + oc: Infrastructura ferroviària + pl: Infrastruktura kolejowa + pt: Infraestrutura ferroviária + pt-br: Infraestrutura ferroviária + ru: Железнодорожная инфраструктура + sr: Железничка инфраструктура + tr: Demiryolu altyapısı +query: + 11: (way[railway=rail][usage~'^(main|branch)$'];node[railway~'^(station)$'];) + 14: (way[railway];node[railway~'^(station|halt|tram_stop)$'];) + 17: (node[railway];way[railway];) +feature: + title: '{% if tags.ref %}{{ localizedTag(tags, ''ref'') }} - {% endif %}{{ localizedTag(tags, ''name'')|default(localizedTag(tags, ''operator'')) }}' + description: |- + {{ tagTrans('railway', tags.railway) -}} + {%- if tags.usage %} + , {{ tagTrans('railway=rail usage', tags.usage) }} + {% endif -%} + {%- if tags.service %} + , {{ tagTrans('railway=rail service', tags.service) }} + {% endif -%} + body: |- + {% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %} + {% if tags.usage %}{{ keyTrans('railway=rail usage') }}: {{ tagTrans('railway=rail usage', tags.usage)|default(trans('unknown')) }}
{% endif %} + {% if tags.service %}{{ keyTrans('railway=rail service') }}: {{ tagTrans('railway=rail service', tags.service ) }}
{% endif %} + {{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}
+ {% if tags.electrified == 'no' %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', 'no') }}{% elseif tags.electrified %}{{ keyTrans('electrified') }}: {{ tagTrans('electrified', tags.electrified) }}, {{ keyTrans('voltage') }}: {{ tags.voltage|default(trans('unknown')) }}, {{ keyTrans('frequency') }}: {{ tags.frequency|default(trans('unknown')) }}
{% endif %} + markerSign: '{% if tags.railway in [ ''halt'', ''tram_stop'', ''station'', ''stop'', ''subway_entrance'' ] %}X{% endif %}' + markerSymbol: |- + {% if tags.railway == 'signal' %} + + + + + + {% elseif tags.railway == 'switch' %} + + + + + + {% elseif tags.railway == 'railway_crossing' %} + + + + + + {% elseif tags.railway not in [ 'rail', 'tram', 'subway', 'narrow_gauge', 'abandoned', 'disused' ] %} + {{ markerPointer({})|raw }} + {% endif %} + listMarkerSymbol: |- + {% if tags.railway in [ 'station', 'halt', 'tram_stop', 'stop', 'subway_entrance', 'signal', 'switch', 'railway_crossing' ] %} + {% else %} + line + {% endif %} + priority: |- + {% if tags.railway == 'station' %}0 + {% elseif tags.railway in [ 'halt' ] %}1 + {% elseif tags.railway in [ 'tram_stop', 'stop' ] %}2 + {% elseif tags.railway in [ 'subway_entrance' ] %}3 + {% else %}5 + {% endif %} + styles: '{% if tags.railway == ''narrow_gauge'' %}default,casing{% else %}default{% endif %}' + style: + width: |- + {% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %} + 1 + {% else %} + {% if tags.railway == 'rail' %} + {% if tags.usage == 'main' or tags.usage == 'branch' %} + 3 + {% else %} + 2 + {% endif %} + {% elseif tags.railway == 'platform' %} + 1 + {% elseif tags.railway in [ 'signal', 'switch', 'railway_crossing' ] %} + 0 + {% else %} + 2 + {% endif %} + {% endif %} + color: '{% if tags.railway == ''rail'' or tags.railway == ''narrow_gauge'' or tags.railway == ''disused'' %}{% if tags.usage == ''main'' %}#ff8100{% elseif tags.usage == ''branch'' %}#daca00{% else %}#000000{% endif %}{% elseif tags.railway == ''subway'' %}#0000ff{% elseif tags.railway == ''tram'' %}#ff00ff{% elseif tags.railway == ''light_rail'' %}#00BD14{% elseif tags.railway == ''platform'' %}#3f3f3f{% else %}#000000{% endif %}' + opacity: '1' + dashArray: '{% if tags.railway == ''rail'' %}{% elseif tags.railway == ''disused'' %}1,5{% elseif tags.railway == ''abandoned'' %}1,7{% endif %}' + fill: |- + {% if tags.railway == 'platform' %} + 1 + {% elseif type == 'node' %} + 1 + {% else %} + {% endif %} + fillColor: |- + {% if tags.railway == 'platform' %} + #3f3f3f + {% elseif type == 'node' %} + #ffffff + {% endif %} + fillOpacity: |- + {% if tags.railway == 'platform' %} + 0.2 + {% elseif type == 'node' %} + 0 + {% endif %} + style:casing: + width: '{% if tags.service == ''yard'' or tags.service == ''siding'' or tags.service == ''spur'' or tags.service == ''crossover'' %}5{% else %}{% if tags.railway == ''rail'' %}{% if tags.usage == ''main'' or tags.usage == ''branch'' %}7{% else %}6{% endif %}{% elseif tags.railway == ''platform'' %}5{% else %}6{% endif %}{% endif %}' + color: '{% if tags.railway == ''rail'' or tags.railway == ''narrow_gauge'' or tags.railway == ''disused'' %}{% if tags.usage == ''main'' %}#ff8100{% elseif tags.usage == ''branch'' %}#daca00{% else %}#000000{% endif %}{% elseif tags.railway == ''subway'' %}#0000ff{% elseif tags.railway == ''tram'' %}#ff00ff{% elseif tags.railway == ''light_rail'' %}#00BD14{% elseif tags.railway == ''platform'' %}#3f3f3f{% else %}#000000{% endif %}' + lineCap: butt + dashArray: '2,4' +info: |- + + + + + + + + + + + + + + + + + + + + + + {% if map.zoom >= 14 %} + + + + + {% endif %} +
{{ markerLine(evaluate({ "railway": "rail", "usage": "main" }))|raw }}{{ tagTrans('railway', 'rail') }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', 'main') }}
{{ markerLine(evaluate({ "railway": "rail" }))|raw }}{{ tagTrans('railway', 'rail') }}
{{ markerLine(evaluate({ "railway": "narrow_gauge" }))|raw }}{{ tagTrans('railway', 'narrow_gauge') }}
{{ markerLine(evaluate({ "railway": "light_rail" }))|raw }}{{ tagTrans('railway', 'light_rail') }}
{{ markerLine(evaluate({ "railway": "subway" }))|raw }}{{ tagTrans('railway', 'subway') }}
{{ markerLine(evaluate({ "railway": "tram" }))|raw }}{{ tagTrans('railway', 'tram') }}
diff --git a/railway-maxspeed.json b/railway-maxspeed.json deleted file mode 100644 index b1e2cc8..0000000 --- a/railway-maxspeed.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "type": "overpass", - "name": { - "ca": "Velocitat màxima de la via fèrria", - "cs": "Maximální rychlost železnice", - "de": "Eisenbahn Höchstgeschwindigkeiten", - "en": "Railway Maxspeed", - "es": "Velocidad máxima del ferrocarril", - "fr": "Limites de vitesse", - "gl": "Velocidade máxima do ferrocarril", - "hu": "Sebességkorlátozás", - "it": "Velocità ferroviaria massima", - "ja": "鉄道の最高速度", - "nb": "Jernbane-fartsgrense", - "nl": "Spoorweg snelheidslimiet", - "oc": "Limits de velocitat", - "pl": "Prędkość maksymalna kolei", - "pt": "Velocidade máxima", - "pt-br": "Velocidade máxima", - "ru": "Максимальная скорость", - "tr": "Demiryolu Maksimum Hızı" - }, - "query": { - "11": "way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$'];", - "14": "way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$'];" - }, - "feature": { - "pre": [ - "{% set maxspeedKmh = null %}", - "{% set maxspeed = null %}", - "{% set unit = null %}", - "", - "{% 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 %}", - "", - "{% 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 maxspeedF or maxspeedB %}", - "{{ maxspeedB|default(trans('unknown')) }} / {{ maxspeedF|default(trans('unknown')) }} {{ unit }}", - "{% elseif maxspeed %}", - "{{ maxspeed }} {{ unit }}", - "{% elseif tags.maxspeed %}", - "{{ tags.maxspeed }}", - "{% else %}", - "{{ trans('unknown') }}", - "{% endif %}" - ], - "markerSymbol": null, - "listMarkerSymbol": "line", - "styles": "{% if maxspeedB or maxspeedF %}left,right,default{% else %}default{% endif %}", - "style": { - "width": "{% if maxspeedB or maxspeedF %}0{% else %}4{% endif %}", - "color": "{{ color }}", - "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": { - "colorMap": [ - "#00af00", - "#ff7f00", - "#ff0000", - "#af00af" - ], - "highestColorSpeed": 300, - "offsetColorSpeed": 20 - }, - "info": [ - "
", - "", - " ", - " ", - " ", - " ", - "{% for i in range(25, 280, 25) %}", - " ", - " ", - " ", - " ", - "{% endfor %}", - " ", - " ", - " ", - " ", - "
{{ markerLine(evaluate({}))|raw }}{{ trans('unknown') }}
{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}{{ i }}km/h
{{ markerLine(evaluate({ \"maxspeed\": 300 }))|raw }}≥300km/h
", - "
", - "", - "
", - "", - " ", - " ", - " ", - " ", - "{% for i in range(15, 150, 15) %}", - " ", - " ", - " ", - " ", - "{% endfor %}", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "
{{ markerLine(evaluate({}))|raw }}{{ trans('unknown') }}
{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}{{ i }}mph
{{ markerLine(evaluate({ \"maxspeed\": (175 * 1.60934)|round }))|raw }}175mph
{{ markerLine(evaluate({ \"maxspeed\": (200 * 1.60934)|round }))|raw }}≥200mph
", - "
" - ] -} diff --git a/railway-maxspeed.yaml b/railway-maxspeed.yaml new file mode 100644 index 0000000..bdf7924 --- /dev/null +++ b/railway-maxspeed.yaml @@ -0,0 +1,164 @@ +type: overpass +name: + ca: Velocitat màxima de la via fèrria + cs: Maximální rychlost železnice + de: Eisenbahn Höchstgeschwindigkeiten + en: Railway Maxspeed + es: Velocidad máxima del ferrocarril + fr: Limites de vitesse + gl: Velocidade máxima do ferrocarril + hu: Sebességkorlátozás + it: Velocità ferroviaria massima + ja: 鉄道の最高速度 + nb: Jernbane-fartsgrense + nl: Spoorweg snelheidslimiet + oc: Limits de velocitat + pl: Prędkość maksymalna kolei + pt: Velocidade máxima + pt-br: Velocidade máxima + ru: Максимальная скорость + tr: Demiryolu Maksimum Hızı +query: + 11: way[railway=rail][railway!~'^(platform|abandoned|disused|station|proposed|subway_entrance)$'][usage~'^(main|branch)$']; + 14: way[railway~'^(disused|construction|funicular|light_rail|miniature|monorail|narrow_gauge|preserved|rail|subway|tram)$']; +feature: + pre: |- + {% set maxspeedKmh = null %} + {% set maxspeed = null %} + {% set unit = null %} + + {% 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 %} + + {% 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 maxspeedF or maxspeedB %} + {{ maxspeedB|default(trans('unknown')) }} / {{ maxspeedF|default(trans('unknown')) }} {{ unit }} + {% elseif maxspeed %} + {{ maxspeed }} {{ unit }} + {% elseif tags.maxspeed %} + {{ tags.maxspeed }} + {% else %} + {{ trans('unknown') }} + {% endif %} + markerSymbol: null + listMarkerSymbol: line + styles: '{% if maxspeedB or maxspeedF %}left,right,default{% else %}default{% endif %}' + style: + width: '{% if maxspeedB or maxspeedF %}0{% else %}4{% endif %}' + color: '{{ color }}' + 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: + colorMap: + - '#00af00' + - '#ff7f00' + - '#ff0000' + - '#af00af' + highestColorSpeed: 300 + offsetColorSpeed: 20 +info: |- +
+ + + + + + {% for i in range(25, 280, 25) %} + + + + + {% endfor %} + + + + +
{{ markerLine(evaluate({}))|raw }}{{ trans('unknown') }}
{{ markerLine(evaluate({ "maxspeed": i }))|raw }}{{ i }}km/h
{{ markerLine(evaluate({ "maxspeed": 300 }))|raw }}≥300km/h
+
+ +
+ + + + + + {% for i in range(15, 150, 15) %} + + + + + {% endfor %} + + + + + + + + +
{{ markerLine(evaluate({}))|raw }}{{ trans('unknown') }}
{{ markerLine(evaluate({ "maxspeed": (i * 1.60934)|round }))|raw }}{{ i }}mph
{{ markerLine(evaluate({ "maxspeed": (175 * 1.60934)|round }))|raw }}175mph
{{ markerLine(evaluate({ "maxspeed": (200 * 1.60934)|round }))|raw }}≥200mph
+
diff --git a/railway-routes.json b/railway-routes.json deleted file mode 100644 index e3c8b62..0000000 --- a/railway-routes.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "type": "overpass", - "name": { - "ca": "Rutes Fèrries", - "cs": "Železniční trasy", - "de": "Eisenbahnrouten", - "en": "Railway Routes", - "es": "Rutas de ferrocarril", - "fr": "Lignes ferroviaires", - "gl": "Liñas de ferrocarril", - "hu": "Vasútvonalak", - "it": "Percorsi ferroviari", - "ja": "鉄道ルート", - "nb": "Jernbaneruter", - "nl": "Spoorwegroutes", - "oc": "Linhas ferroviàrias", - "pl": "Trasy kolejowe", - "pt": "Rotas ferroviárias", - "pt-br": "Rotas ferroviárias", - "ru": "Железнодорожные маршруты", - "sr": "Трасе железнице", - "tr": "Demiryolu Güzergahları" - }, - "query": { - "12": "relation[type=route][route=railway]" - }, - "members": true, - "feature": { - "pre": "{% set color = '#' ~ tags.operator|default('')|md5|slice(0, 6) %}", - "listMarkerSymbol": "{{ markerLine({ 'width': 4, 'color': color })|raw }}", - "description": "{{ tags.operator }}", - "title": "{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}", - "styles": "", - "markerSymbol": "" - }, - "memberFeature": { - "pre": [ - "{% set refs = [] %}", - "{% set color = '#d41d8c' %}", - "", - "{% for master in masters %}", - " {% if master.tags.operator %}", - " {% set color = '#' ~ master.tags.operator|md5|slice(0, 6) %}", - " {% endif %}", - " {% if master.tags.ref %}", - " {% set refs = refs|merge([ master.tags.ref ]) %}", - " {% endif %}", - "{% endfor %}" - ], - "title": "", - "body": [ - "

Routes

", - "" - ], - "listExclude": "1", - "style": { - "color": "{{ color }}", - "width": 4, - "opacity": 1, - "text": "{{ refs|join(' · ') }} ", - "textRepeat": "1", - "textOffset": "12", - "textFontWeight": "bold" - } - } -} diff --git a/railway-routes.yaml b/railway-routes.yaml new file mode 100644 index 0000000..650e590 --- /dev/null +++ b/railway-routes.yaml @@ -0,0 +1,66 @@ +type: overpass +name: + ca: Rutes Fèrries + cs: Železniční trasy + de: Eisenbahnrouten + en: Railway Routes + es: Rutas de ferrocarril + fr: Lignes ferroviaires + gl: Liñas de ferrocarril + hu: Vasútvonalak + it: Percorsi ferroviari + ja: 鉄道ルート + nb: Jernbaneruter + nl: Spoorwegroutes + oc: Linhas ferroviàrias + pl: Trasy kolejowe + pt: Rotas ferroviárias + pt-br: Rotas ferroviárias + ru: Железнодорожные маршруты + sr: Трасе железнице + tr: Demiryolu Güzergahları +query: + 12: relation[type=route][route=railway] +members: true +feature: + pre: '{% set color = ''#'' ~ tags.operator|default('''')|md5|slice(0, 6) %}' + listMarkerSymbol: '{{ markerLine({ ''width'': 4, ''color'': color })|raw }}' + description: '{{ tags.operator }}' + title: '{% if tags.ref and tags.name %}{{ tags.ref }} - {{ tags.name }}{% elseif tags.ref %}{{ tags.ref }}{% elseif tags.name %}{{ tags.name }}{% endif %}' + styles: '' + markerSymbol: '' +memberFeature: + pre: |- + {% set refs = [] %} + {% set color = '#d41d8c' %} + + {% for master in masters %} + {% if master.tags.operator %} + {% set color = '#' ~ master.tags.operator|md5|slice(0, 6) %} + {% endif %} + {% if master.tags.ref %} + {% set refs = refs|merge([ master.tags.ref ]) %} + {% endif %} + {% endfor %} + title: '' + body: |- +

Routes

+ + listExclude: '1' + style: + color: '{{ color }}' + width: 4 + opacity: 1 + text: '{{ refs|join('' · '') }} ' + textRepeat: '1' + textOffset: '12' + textFontWeight: bold