diff --git a/lanes.json b/lanes.json index 8adcbc5..e72dd6f 100644 --- a/lanes.json +++ b/lanes.json @@ -4,15 +4,27 @@ "en": "Lanes" }, "query": { - "17": "way[lanes];" + "17": [ + "(", + "way[lanes];", + "way['parking:lane:left'];", + "way['parking:lane:right'];", + "way['parking:lane:both'];", + ")" + ] }, "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 %}" + "{% set parking_left = attribute(tags, 'parking:lane:left')|default(attribute(tags, 'parking:lane:both')) %}", + "{% 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 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) %}" ], - "description": "{{ tags.gauge|default(trans('unknown'))|enumerate }}", + "description": "{{ keyTrans('lanes') }}: {{ lanes }} | {{ forward_lanes }} {{ backward_lanes }}", "body": [ "{{ tagTrans('railway', tags.railway) }}
", "{% if tags.operator %}{{ keyTrans('operator') }}: {{ localizedTag(tags, 'operator') }}
{% endif %}", @@ -23,7 +35,7 @@ ], "markerSymbol": null, "listMarkerSymbol": "line", - "styles": "{% if parking_left %}parking_left,{% endif %}lanes{% for i in 1..tags.lanes - 1 %},mark{{ i }}{% endfor %}", + "styles": "{% if parking_left %}parking_left,{% endif %}{% if cyclelane_left %}cyclelane_left,{% endif %}{% if lanes == 1 %}lane1{% else %}{% for i in 1..lanes - 1 %}lane{{ i }},mark{{ i }},{% endfor %}lane{{ lanes }}{% endif %}{% if cyclelane_right %},cyclelane_right{% endif %}{% if parking_right %},parking_right{% endif %}", "style": { "width": "{{ width }}", "pane": "casing", @@ -32,98 +44,175 @@ "style:parking_left": { "width": "2m", "color": "orange", + "offset": "{{ lanes_width / -2 - (cyclelane_left * 2) - 1 }}m", + "pane": "casing" + }, + "style:cyclelane_left": { + "width": "2m", + "color": "green", "offset": "{{ lanes_width / -2 - 1 }}m", - "text": "foobar" + "pane": "casing" + }, + "style:cyclelane_right": { + "width": "2m", + "color": "green", + "offset": "{{ lanes_width / 2 + 1 }}m", + "pane": "casing" + }, + "style:parking_right": { + "width": "2m", + "color": "orange", + "offset": "{{ lanes_width / 2 + (cyclelane_right * 2) + 1 }}m", + "pane": "casing" + }, + "style:lane1": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 1.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane2": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 4.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane3": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 7.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane4": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 10.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane5": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 13.5 }}m", + "color": "grey", + "pane": "casing" }, - "style:lanes": { - "width": "{{ lanes_width }}m", + "style:lane6": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 16.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane7": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 19.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane8": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 22.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane9": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 25.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane10": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 28.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane11": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 31.5 }}m", + "color": "grey", + "pane": "casing" + }, + "style:lane12": { + "width": "3m", + "offset": "{{ lanes_width / -2 + 34.5 }}m", "color": "grey", "pane": "casing" }, "style:mark1": { "width": "1", "offset": "{{ lanes_width / -2 + 3 }}m", + "dashArray": "{% if forward_lanes != 1 and lanes - 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 %}", "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 %}", "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 %}", "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 %}", "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 %}", "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 %}", "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 %}", "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 %}", "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 %}", "color": "white" }, "style:mark11": { "width": "1", "offset": "{{ lanes_width / -2 + 18 }}m", - "color": "white" - }, - "style:mark12": { - "width": "1", - "offset": "{{ lanes_width / -2 + 18 }}m", + "dashArray": "{% if forward_lanes != 11 and lanes - backward_lanes != 11 %}5,5{% endif %}", "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({'styles':'left,right,mark', 'style:left': { 'width': 3, 'color': 'grey', 'offset': -1.5 },'style:right': { 'width': 3, 'color': 'grey', 'offset': 1.5 },'style:mark': { 'width': 1, 'color': 'white'} })|raw }}{{ keyTrans('lanes') }}
{{ markerLine({ 'width': 3, 'color': '#0000ff' })|raw }}>2000mm{{ markerLine({'styles':'left,right,mark', 'style:left': { 'width': 3, 'color': 'grey', 'offset': -1.5 },'style:right': { 'width': 3, 'color': 'grey', 'offset': 1.5 },'style:mark': { 'width': 1, 'color': 'white', 'dashArray': '5,5'} })|raw }}{{ keyTrans('lanes') }}
" ]