-
Notifications
You must be signed in to change notification settings - Fork 11
/
railway-gauge.yaml
114 lines (114 loc) · 4.78 KB
/
railway-gauge.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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) }}<br/>
{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}<br>{% endif %}
{% if tags.usage %}{{ keyTrans('usage') }}: {{ tagTrans('usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}
{% if tags.service %}{{ keyTrans('service') }}: {{ tagTrans('service', tags.service ) }}<br/>{% endif %}
{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown'))|enumerate }}<br/>
{% 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')) }}<br/>{% 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: |-
<table>
{% set color = '#ff0000' %}
<tr>
<td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>
<td>{{ trans('illegal value') }}</td>
</tr>
{% set color = '#404040' %}
<tr>
<td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>
<td>{{ trans('unknown') }}</td>
</tr>
{% for i in range(0, 1800, 250) %}
{% set color = colorInterpolate([ '#00ff00', '#0000ff' ], i / 2000) %}
<tr>
<td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>
<td>{{ i }}mm</td>
</tr>
{% endfor %}
<tr>
<td>{{ markerLine({ 'width': 3, 'color': '#0000ff' })|raw }}</td>
<td>>2000mm</td>
</tr>
</table>