2 Commits

  1. 209
      cycle_route_infrastructure.yaml

209
cycle_route_infrastructure.yaml

@ -0,0 +1,209 @@
query:
10: relation[route=bicycle]
members: true
feature:
markerSymbol: ''
styles: ''
memberFeature:
exclude: |
{% if type == 'relation' or type == 'node' %}true{% endif %}
pre: |
{% set type = 'other' %}
{% set lane_left = null %}
{% set lane_right = null %}
{% set segregated = 'xxx' %}
{% if attribute(tags, 'bicycle_road') == 'yes' or attribute(tags, 'cyclestreet') == 'yes' %}
{% set type = 'bicycle_road' %}
{% elseif tags.highway == 'cycleway' or (tags.highway == 'path' and tags.bicycle == 'designated') %}
{% set type = tags.oneway in ['yes', '1'] ? 'cycleway_oneway' : 'cycleway' %}
{% set segregated = tags.segregated != 'no' %}
{% elseif tags.highway in ['living_street', 'pedestrian'] %}
{% set type = tags.highway %}
{% elseif tags.highway in ['residential', 'service', 'unclassified'] or tags.max_speed > 30 %}
{% set type = 'mixed_low' %}
{% if tags.oneway in ['yes', '1'] %}
{% set type = type ~ '_oneway' %}
{% set lane_left = attribute(tags, 'oneway:bicycle') in ['no'] ? 'opposite_lane' : null %}
{% endif %}
{% elseif tags.highway in ['primary_link', 'primary', 'secondary_link', 'secondary', 'tertiary_link', 'tertiary'] %}
{% set type = 'mixed_high' %}
{% if tags.oneway in ['yes', '1'] %}
{% set type = type ~ '_oneway' %}
{% set lane_left = attribute(tags, 'oneway:bicycle') in ['no'] ? 'opposite_lane' : null %}
{% endif %}
{% endif %}
{% if attribute(tags, 'cycleway:right') in ['lane', 'track'] %}
{% set lane_right = attribute(tags, 'cycleway:right') %}
{% set type = null %}
{% endif %}
{% if attribute(tags, 'cycleway') in ['opposite_lane', 'opposite_track'] %}
{% set lane_left = attribute(tags, 'cycleway') %}
{% endif %}
{% if attribute(tags, 'cycleway:left') in ['lane', 'track'] %}
{% set lane_left = 'opposite_' ~ attribute(tags, 'cycleway:left') %}
{% elseif attribute(tags, 'cycleway:left') in ['opposite_lane', 'opposite_track'] %}
{% set lane_left = attribute(tags, 'cycleway:left') %}
{% endif %}
{% set main_style_segregated = {} %}
{% if not segregated %}
{% if const.type[type].dashArray %}
{% set main_style_segregated = { dashArray: '5,5,5,5,5,10', lineCap: 'butt' } %}
{% else %}
{% set main_style_segregated = { dashArray: '5,5', lineCap: 'butt' } %}
{% endif %}
{% endif %}
styles: |
{% set list = type ? ['default'] : [] %}
{% if lane_left %}{% set list = list|merge(['lane_left']) %}{% endif %}
{% if lane_right %}{% set list = list|merge(['lane_right']) %}{% endif %}
{% if not segregated %}{% set list = ['segregated']|merge(list) %}{% endif %}
{{ list|join(',')|debug }}
style: |
{{ const.type[type]|default({})|merge(main_style_segregated)|json_encode|raw }}
style:segregated:
width: 4
color: '#00000000'
style:lane_right: |
{{ const.lane[lane_right]|default({})|json_encode|raw }}
style:lane_left: |
{{ const.lane[lane_left]|default({})|merge({ offset: const.lane[lane_left].offset * -1, 'pattern-lineOffset': const.lane[lane_left]['pattern-lineOffset'] * -1 })|json_encode|raw }}
style:segregated:
width: |
{{ const.type[type].width }}
color: '#00ffaf'
body: |
{{ type }}, right: {{ lane_right }}, left: {{ lane_left }}<br>
default{{ lane_left ? ',lane_left' : '' }}{{ lane_right ? ',lane_right' : '' }}<br>
{{ segregated }}{{ segregated ? 'segregated' : 'not segregated' }}: {{ main_style_segregated|json_encode }}
const:
type:
cycleway:
width: 4
color: '#007f00'
cycleway_oneway:
width: 2.5
color: '#007f00'
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-offset: 30.5
pattern-polygon: true
pattern-pixelSize: 9
pattern-path-width: 0
pattern-path-color: '#007f00'
pattern-path-fillOpacity: 1
pedestrian:
width: 4
color: '#00ffaf'
living_street:
width: 4
color: '#00afaf'
bicycle_road:
width: 4
color: '#00afff'
mixed_low:
width: 4
color: '#efaf00'
mixed_high:
width: 4
color: '#ff7f00'
mixed_low_oneway:
width: 4
color: '#efaf00'
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-offset: 30.5
pattern-polygon: true
pattern-pixelSize: 12
pattern-path-width: 0
pattern-path-color: '#efaf00'
pattern-path-fillOpacity: 1
mixed_high_oneway:
width: 4
color: '#ff7f00'
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-offset: 30.5
pattern-polygon: true
pattern-pixelSize: 12
pattern-path-width: 0
pattern-path-color: '#ff7f00'
pattern-path-fillOpacity: 1
other:
width: 4
color: '#ff0000'
lane:
opposite_lane:
width: 2
color: '#00af00'
offset: 4
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-angleCorrection: 180
pattern-offset: 0
pattern-lineOffset: 4
pattern-polygon: true
pattern-pixelSize: 9
pattern-path-width: 0
pattern-path-color: '#00af00'
pattern-path-fillOpacity: 1
lane:
width: 2
color: '#00af00'
offset: 4
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-offset: 30.5
pattern-lineOffset: 4
pattern-polygon: true
pattern-pixelSize: 9
pattern-path-width: 0
pattern-path-color: '#00af00'
pattern-path-fillOpacity: 1
opposite_track:
width: 2.5
color: '#007f00'
offset: 4
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-angleCorrection: 180
pattern-offset: 0
pattern-lineOffset: 4
pattern-polygon: true
pattern-pixelSize: 9
pattern-path-width: 0
pattern-path-color: '#007f00'
pattern-path-fillOpacity: 1
track:
width: 2.5
color: '#007f00'
offset: 4
noClip: true
dashArray: '25,10'
pattern: arrowHead
pattern-repeat: 35
pattern-offset: 30.5
pattern-lineOffset: 4
pattern-polygon: true
pattern-pixelSize: 9
pattern-path-width: 0
pattern-path-color: '#007f00'
pattern-path-fillOpacity: 1
Loading…
Cancel
Save