From b97e89867a694aa9b3732053e731a105c21ef76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 9 Jan 2020 13:18:30 +0100 Subject: [PATCH] Lanes: improvements --- lanes.json | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lanes.json b/lanes.json index e72dd6f..bafb0a3 100644 --- a/lanes.json +++ b/lanes.json @@ -19,12 +19,13 @@ "{% set parking_right = attribute(tags, 'parking:lane:right')|default(attribute(tags, 'parking:lane:both')) %}", "{% set cyclelane_left = 'opposite_lane' in tags.cycleway|split(';') ? 1 : 0 %}", "{% set cyclelane_right = 'lane' in tags.cycleway|split(';') ? 1 : 0 %}", - "{% set lanes = tags.lanes|default(1) %}", + "{% set oneway = tags.oneway in ['yes','1'] %}", + "{% set lanes = tags.lanes|default(oneway ? 1 : 2) %}", "{% set lanes_width = lanes * 3 %}", - "{% set forward_lanes = attribute(tags, 'lanes:forward')|default(tags.oneway in ['yes','1'] ? lanes : lanes / 2) %}", - "{% set backward_lanes = attribute(tags, 'lanes:backward')|default(tags.oneway in ['yes','1'] ? 0 : lanes / 2) %}" + "{% set forward_lanes = attribute(tags, 'lanes:forward')|default(oneway ? lanes : lanes // 2) %}", + "{% set backward_lanes = attribute(tags, 'lanes:backward')|default(oneway ? 0 : lanes // 2) %}" ], - "description": "{{ keyTrans('lanes') }}: {{ lanes }} | {{ forward_lanes }} {{ backward_lanes }}", + "description": "{{ keyTrans('lanes') }}: {% if tags.lanes %}{{ tags.lanes }}{% else %}{{ lanes }}?{% endif %} {% if attribute(tags, 'lanes:forward') or attribute(tags, 'lanes:backward') %}(↑{{ forward_lanes }} ↓{{ backward_lanes }}){% endif %}", "body": [ "{{ tagTrans('railway', tags.railway) }}
", "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}", @@ -140,67 +141,67 @@ "style:mark1": { "width": "1", "offset": "{{ lanes_width / -2 + 3 }}m", - "dashArray": "{% if forward_lanes != 1 and lanes - backward_lanes != 1 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 1 and backward_lanes != 1 %}5,5{% endif %}", "color": "white" }, "style:mark2": { "width": "1", "offset": "{{ lanes_width / -2 + 6 }}m", - "dashArray": "{% if forward_lanes != 2 and lanes - backward_lanes != 2 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 2 and backward_lanes != 2 %}5,5{% endif %}", "color": "white" }, "style:mark3": { "width": "1", "offset": "{{ lanes_width / -2 + 9 }}m", - "dashArray": "{% if forward_lanes != 3 and lanes - backward_lanes != 3 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 3 and backward_lanes != 3 %}5,5{% endif %}", "color": "white" }, "style:mark4": { "width": "1", "offset": "{{ lanes_width / -2 + 12 }}m", - "dashArray": "{% if forward_lanes != 4 and lanes - backward_lanes != 4 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 4 and backward_lanes != 4 %}5,5{% endif %}", "color": "white" }, "style:mark5": { "width": "1", "offset": "{{ lanes_width / -2 + 15 }}m", - "dashArray": "{% if forward_lanes != 5 and lanes - backward_lanes != 5 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 5 and backward_lanes != 5 %}5,5{% endif %}", "color": "white" }, "style:mark6": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "dashArray": "{% if forward_lanes != 6 and lanes - backward_lanes != 6 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 6 and backward_lanes != 6 %}5,5{% endif %}", "color": "white" }, "style:mark7": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "dashArray": "{% if forward_lanes != 7 and lanes - backward_lanes != 7 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 7 and backward_lanes != 7 %}5,5{% endif %}", "color": "white" }, "style:mark8": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "dashArray": "{% if forward_lanes != 8 and lanes - backward_lanes != 8 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 8 and backward_lanes != 8 %}5,5{% endif %}", "color": "white" }, "style:mark9": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "dashArray": "{% if forward_lanes != 9 and lanes - backward_lanes != 9 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 9 and backward_lanes != 9 %}5,5{% endif %}", "color": "white" }, "style:mark10": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "dashArray": "{% if forward_lanes != 10 and lanes - backward_lanes != 10 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 10 and backward_lanes != 10 %}5,5{% endif %}", "color": "white" }, "style:mark11": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "dashArray": "{% if forward_lanes != 11 and lanes - backward_lanes != 11 %}5,5{% endif %}", + "dashArray": "{% if lanes - forward_lanes != 11 and backward_lanes != 11 %}5,5{% endif %}", "color": "white" } },