diff --git a/lanes.json b/lanes.json new file mode 100644 index 0000000..8adcbc5 --- /dev/null +++ b/lanes.json @@ -0,0 +1,130 @@ +{ + "type": "overpass", + "name": { + "en": "Lanes" + }, + "query": { + "17": "way[lanes];" + }, + "feature": { + "pre": [ + "{% set parking_left = attribute(tags, 'parking:lane:left')|default(attribute(tags, 'parking:lang:both')) %}", + "{% set parking_right = attribute(tags, 'parking:lane:right')|default(attribute(tags, 'parking:lang:both')) %}", + "{% set lanes_width = tags.lanes * 3 %}" + ], + "description": "{{ 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 parking_left %}parking_left,{% endif %}lanes{% for i in 1..tags.lanes - 1 %},mark{{ i }}{% endfor %}", + "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:parking_left": { + "width": "2m", + "color": "orange", + "offset": "{{ lanes_width / -2 - 1 }}m", + "text": "foobar" + }, + "style:lanes": { + "width": "{{ lanes_width }}m", + "color": "grey", + "pane": "casing" + }, + "style:mark1": { + "width": "1", + "offset": "{{ lanes_width / -2 + 3 }}m", + "color": "white" + }, + "style:mark2": { + "width": "1", + "offset": "{{ lanes_width / -2 + 6 }}m", + "color": "white" + }, + "style:mark3": { + "width": "1", + "offset": "{{ lanes_width / -2 + 9 }}m", + "color": "white" + }, + "style:mark4": { + "width": "1", + "offset": "{{ lanes_width / -2 + 12 }}m", + "color": "white" + }, + "style:mark5": { + "width": "1", + "offset": "{{ lanes_width / -2 + 15 }}m", + "color": "white" + }, + "style:mark6": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + }, + "style:mark7": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + }, + "style:mark8": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + }, + "style:mark9": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + }, + "style:mark10": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + }, + "style:mark11": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + }, + "style:mark12": { + "width": "1", + "offset": "{{ lanes_width / -2 + 18 }}m", + "color": "white" + } + }, + "info": [ + "{{ map.metersPerPixel }}", + "", + " {% 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
" + ] +}