Browse Source

Lanes: simplify code (variables contain width)

name-etym
parent
commit
96d68bb3f8
  1. 28
      lanes.json

28
lanes.json

@ -15,15 +15,15 @@
},
"feature": {
"pre": [
"{% set parking_left = attribute(tags, 'parking:lane:left')|default(attribute(tags, 'parking:lane:both')) ? 1 : 0 %}",
"{% set parking_right = attribute(tags, 'parking:lane:right')|default(attribute(tags, 'parking:lane:both')) ? 1 : 0 %}",
"{% set oneway = tags.oneway in ['yes','1'] %}",
"{% set cyclelane_left = attribute(tags, 'cycleway:left') == 'lane' ? 1 : ('opposite_lane' in tags.cycleway|split(';') ? 1 : (('lane' in tags.cycleway|split(';')) and not oneway ? 1 : 0)) %}",
"{% set cyclelane_right = attribute(tags, 'cycleway:right') == 'lane' ? 1 : ('lane' in tags.cycleway|split(';') ? 1 : 0) %}",
"{% set cycletrack_left = attribute(tags, 'cycleway:left') == 'track' ? 1 : ('opposite_track' in tags.cycleway|split(';') ? 1 : (('track' in tags.cycleway|split(';')) and not oneway ? 1 : 0)) %}",
"{% set cycletrack_right = attribute(tags, 'cycleway:right') == 'track' ? 1 : ('track' in tags.cycleway|split(';') ? 1 : 0) %}",
"{% set sidewalk_left = tags.sidewalk in ['both', 'left'] ? 1 : 0 %}",
"{% set sidewalk_right = tags.sidewalk in ['both', 'right'] ? 1 : 0 %}",
"{% set parking_left = attribute(tags, 'parking:lane:left')|default(attribute(tags, 'parking:lane:both')) ? 2 : 0 %}",
"{% set parking_right = attribute(tags, 'parking:lane:right')|default(attribute(tags, 'parking:lane:both')) ? 2 : 0 %}",
"{% set cyclelane_left = attribute(tags, 'cycleway:left') == 'lane' ? 2 : ('opposite_lane' in tags.cycleway|split(';') ? 2 : (('lane' in tags.cycleway|split(';')) and not oneway ? 2 : 0)) %}",
"{% set cyclelane_right = attribute(tags, 'cycleway:right') == 'lane' ? 2 : ('lane' in tags.cycleway|split(';') ? 2 : 0) %}",
"{% set cycletrack_left = attribute(tags, 'cycleway:left') == 'track' ? 2 : ('opposite_track' in tags.cycleway|split(';') ? 2 : (('track' in tags.cycleway|split(';')) and not oneway ? 2 : 0)) %}",
"{% set cycletrack_right = attribute(tags, 'cycleway:right') == 'track' ? 2 : ('track' in tags.cycleway|split(';') ? 2 : 0) %}",
"{% set sidewalk_left = tags.sidewalk in ['both', 'left'] ? 2 : 0 %}",
"{% set sidewalk_right = tags.sidewalk in ['both', 'right'] ? 2 : 0 %}",
"{% set lanes = tags.lanes|default(oneway ? 1 : 2) %}",
"{% set lanes_width = lanes * 3 %}",
"{% set forward_lanes = attribute(tags, 'lanes:forward')|default(oneway ? lanes : lanes // 2) %}",
@ -49,13 +49,13 @@
"style:sidewalk_left": {
"width": "2m",
"color": "#4f4fbf",
"offset": "{{ lanes_width / -2 - (cyclelane_left * 2) - (parking_left * 2) - (cycletrack_left * 2) - 1 }}m",
"offset": "{{ lanes_width / -2 - cyclelane_left - parking_left - cycletrack_left - 1 }}m",
"pane": "casing"
},
"style:parking_left": {
"width": "2m",
"color": "orange",
"offset": "{{ lanes_width / -2 - (cyclelane_left * 2) - 1 }}m",
"offset": "{{ lanes_width / -2 - cyclelane_left - 1 }}m",
"pane": "casing"
},
"style:cyclelane_left": {
@ -73,25 +73,25 @@
"style:cycletrack_left": {
"width": "2m",
"color": "#bf5f3f",
"offset": "{{ lanes_width / -2 - (cyclelane_left * 2) - (parking_left * 2) - 1 }}m",
"offset": "{{ lanes_width / -2 - cyclelane_left - parking_left - 1 }}m",
"pane": "casing"
},
"style:cycletrack_right": {
"width": "2m",
"color": "#bf5f3f",
"offset": "{{ lanes_width / 2 + (cyclelane_right * 2) + (parking_right * 2) + 1 }}m",
"offset": "{{ lanes_width / 2 + cyclelane_right + parking_right + 1 }}m",
"pane": "casing"
},
"style:parking_right": {
"width": "2m",
"color": "orange",
"offset": "{{ lanes_width / 2 + (cyclelane_right * 2) + 1 }}m",
"offset": "{{ lanes_width / 2 + cyclelane_right + 1 }}m",
"pane": "casing"
},
"style:sidewalk_right": {
"width": "2m",
"color": "#4f4fbf",
"offset": "{{ lanes_width / 2 + (cyclelane_right * 2) + (parking_right * 2) + (cycletrack_right * 2) + 1 }}m",
"offset": "{{ lanes_width / 2 + cyclelane_right + parking_right + cycletrack_right + 1 }}m",
"pane": "casing"
},
"style:lane1": {

Loading…
Cancel
Save