Browse Source

railway-rails: calc type in pre, use this for color

railway-rails
parent
commit
cf7cc319e8
  1. 14
      railway-rails.yaml

14
railway-rails.yaml

@ -4,6 +4,13 @@ query:
13: way[railway~"^(rail|narrow_gauge|subway|light_rail|tram|abandoned|disused|razed)$"]; 13: way[railway~"^(rail|narrow_gauge|subway|light_rail|tram|abandoned|disused|razed)$"];
feature: feature:
pre: |- 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 width = 2 %} {% set width = 2 %}
{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %} {% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}
{% set width = 1 %} {% set width = 1 %}
@ -21,7 +28,10 @@ feature:
{% if attribute(tags, 'tunnel:name') %}- {{ localizedTag(tags, 'tunnel:name') }}{% endif %} {% if attribute(tags, 'tunnel:name') %}- {{ localizedTag(tags, 'tunnel:name') }}{% endif %}
{% if attribute(tags, 'bridge:name') %}- {{ localizedTag(tags, 'bridge:name') }}{% endif %} {% if attribute(tags, 'bridge:name') %}- {{ localizedTag(tags, 'bridge:name') }}{% endif %}
description: |- description: |-
{{ tagTrans('railway', tags.railway) -}}
{{ tagTrans('railway', type) }}
{% if lifecyle != 'active' %}
({{ tagTrans('railway', lifecyle) }})
{%- endif -%}
{%- if tags.usage %} {%- if tags.usage %}
, {{ tagTrans('railway=rail usage', tags.usage) }} , {{ tagTrans('railway=rail usage', tags.usage) }}
{% endif -%} {% endif -%}
@ -56,7 +66,7 @@ feature:
zIndex: |- zIndex: |-
{{ tags.layer|default(0) + 10 }} {{ tags.layer|default(0) + 10 }}
color: |- color: |-
{% set color = tags.railway == 'rail' or tags.railway == 'narrow_gauge' or tags.railway == 'disused' ? const.color['rail/' ~ tags.usage]|default(const.color.rail) : const.color[tags.railway]|default(const.color.default) %}
{% set color = const.color[type ~ '/' ~ tags.usage]|default(const.color[type]) %}
{% if tags.tunnel and tags.tunnel != 'no' %} {% if tags.tunnel and tags.tunnel != 'no' %}
{{ colorInterpolate([ color, '#ffffff' ], 0.3) }} {{ colorInterpolate([ color, '#ffffff' ], 0.3) }}

Loading…
Cancel
Save