Main categories of OpenStreetBrowser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

165 lines
5.3 KiB

type: overpass
query:
11: way[railway~"^(rail|narrow_gauge|subway|light_rail)$"][usage~'^(main|branch)$'];
15: way[railway~"^(rail|narrow_gauge|funicular|monorail|narrow_gauge|subway|light_rail|tram|construction|proposed|abandoned|disused|razed)$"];
feature:
pre: |-
{% set type = tags.railway %}
{% set lifecyle = 'active' %}
{% if tags.railway in ['abandoned', 'construction', 'proposed', 'disused', 'razed'] %}
{% set lifecyle = tags.railway %}
{% set type = attribute(tags, tags.railway)|default(attribute(tags, tags.railway ~ ':railway')) %}
{% endif %}
{% set color = const.types[type ~ '/' ~ tags.usage].color|default(const.types[type].color)|default(const.types.default.color) %}
{% if tags.tunnel and tags.tunnel != 'no' %}
{% set color = colorInterpolate([ color, '#ffffff' ], 0.3) %}
{% endif %}
{% set width = 2 %}
{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}
{% set width = 1 %}
{% elseif tags.railway in ['rail', 'narrow_gauge', 'abandoned', 'disused', 'razed'] %}
{% if tags.usage in ['main', 'branch'] %}
{% set width = 3 %}
{% else %}
{% set width = 2 %}
{% endif %}
{% endif %}
title: |-
{% if tags.ref %}{{ localizedTag(tags, 'ref') }} - {% endif %}
{{ localizedTag(tags, 'name')|default(localizedTag(tags, 'operator')) }}
{% if attribute(tags, 'tunnel:name') %}- {{ localizedTag(tags, 'tunnel:name') }}{% endif %}
{% if attribute(tags, 'bridge:name') %}- {{ localizedTag(tags, 'bridge:name') }}{% endif %}
description: |-
{{ tagTrans('railway', type) }}
{% if lifecyle != 'active' %}
({{ tagTrans('railway', lifecyle) }})
{%- endif -%}
{%- 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') }}<br>{% endif %}
{% if tags.usage %}{{ keyTrans('railway=rail usage') }}: {{ tagTrans('railway=rail usage', tags.usage)|default(trans('unknown')) }}<br/>{% endif %}
{% if tags.service %}{{ keyTrans('railway=rail service') }}: {{ tagTrans('railway=rail service', tags.service ) }}<br/>{% endif %}
{{ keyTrans('gauge') }}: {{ tags.gauge|default(trans('unknown')) }}<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')) }}
{% endif %}<br/>
markerSign: |-
{% if tags.railway in [ 'halt', 'tram_stop', 'station', 'stop', 'subway_entrance' ] %}X
{% endif %}
markerSymbol: false
listMarkerSymbol: line
styles: |-
{% if tags.bridge and tags.bridge != 'no' %}casing_bridge,{% endif %}
{% if const.types[tags.railway] %}casing,casing_layer,{% endif %}
{% if tags.railway in ['abandoned', 'disused', 'razed'] %}disused,{% endif %}
{% if tags.railway == 'narrow_gauge' %}default,narrow
{% else %}default
{% endif %}
style:
width: |-
{{ width }}
zIndex: |-
{{ tags.layer|default(0) + 10 }}
color: |-
{{ color }}
opacity: 1
dashArray: |-
{% if tags.railway == 'disused' %}1,5
{% elseif tags.railway == 'abandoned' %}1,7
{% elseif tags.railway == 'razed' %}1,9
{% endif %}
fill: false
style:disused:
width: |-
{{ width }}
zIndex: |-
{{ tags.layer|default(0) + 9.995 }}
color: white
opacity: 1
fill: false
style:casing:
color: '#ffffff'
pane: casing
width: |-
{{ width + 2 }}
style:casing_layer:
color: '#ffffff'
zIndex: |-
{{ tags.layer|default(0) + 9.99 }}
width: |-
{{ width + 2 }}
lineCap: butt
style:casing_bridge:
color: '#000000'
zIndex: |-
{{ tags.layer|default(0) + 9.98 }}
width: |-
{{ width + 4 }}
lineCap: butt
style:narrow:
width: |-
{{ width + 2 }}
color: |-
{{ color }}
lineCap: butt
dashArray: '2,4'
info: |-
<table>
{% for k, v in const.types %}
{% if not v.hideInfo %}
{% set railway_usage = k|split('/') %}
{% if railway_usage|length == 2 %}
<tr>
<td>{{ markerLine(evaluate({ 'railway': railway_usage[0], 'usage': railway_usage[1] }))|raw }}</td>
<td>{{ tagTrans('railway', railway_usage[0]) }}, {{ keyTrans('usage') }}: {{ tagTrans('usage', railway_usage[1]) }}</td>
</tr>
{% else %}
<tr>
<td>{{ markerLine(evaluate({ "railway": k }))|raw }}</td>
<td>{{ tagTrans('railway', k) }}</td>
</tr>
{% endif %}
{% endif %}
{% endfor %}
</table>
const:
types:
rail/main:
color: '#ff8100'
rail/branch:
color: '#daca00'
rail:
color: '#000000'
narrow_gauge:
color: '#000000'
subway:
color: '#0000ff'
tram:
color: '#ff00ff'
light_rail:
color: '#ff007f'
funicular:
color: '#00BD14'
monorail:
color: '#007f00'
default:
color: '#ff0000'
hideInfo: true