Browse Source

cycleway_width: configure values via const, map info

master
parent
commit
858fa233c0
  1. 34
      cycleway_width.yaml

34
cycleway_width.yaml

@ -12,10 +12,11 @@ feature:
{% set width = (width|slice(0, -1)) * 0.3048 %} {% set width = (width|slice(0, -1)) * 0.3048 %}
{% endif %} {% endif %}
{% set optWidth = tags.oneway in ['yes', 1, -1] ? 3 : 5 %}
{% set minWidth = tags.oneway in ['yes', 1, -1] ? const.minWidthOneway : const.minWidthBoth %}
{% set optWidth = tags.oneway in ['yes', 1, -1] ? const.optWidthOneway : const.optWidthBoth %}
{% if width %} {% if width %}
{{ colorInterpolate(['#ff0000', '#7f7f7ff'], width / optWidth) }}
{{ colorInterpolate(const.colorScheme, (width - minWidth) / (optWidth - minWidth)) }}
{% else %}black {% else %}black
{% endif %} {% endif %}
markerSymbol: false markerSymbol: false
@ -40,3 +41,32 @@ feature:
{{ attribute(tags, 'cycleway:width') }}m {{ attribute(tags, 'cycleway:width') }}m
{% endif %} {% endif %}
</ul> </ul>
info: |
<table>
<tr>
<th>Symbol</th>
<th>{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'yes') }}</th>
<th>{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'no') }}</th>
</tr>
{% for v in range(0, 1, 0.25) %}
<tr>
<td>
{{ markerLine({ width: 4, color: colorInterpolate(const.colorScheme, v) }) }}
</td>
<td>
{% if v == 0 %}<={% elseif v == 1 %}>={% endif %}
{{ (const.minWidthOneway + (v * (const.optWidthOneway - const.minWidthOneway)))|number_format(2) }}m
</td>
<td>
{% if v == 0 %}<={% elseif v == 1 %}>={% endif %}
{{ (const.minWidthBoth + (v * (const.optWidthBoth - const.minWidthBoth)))|number_format(2) }}m
</td>
</tr>
{% endfor %}
</table>
const:
minWidthBoth: 1.5
optWidthBoth: 5
minWidthOneway: 0.75
optWidthOneway: 3
colorScheme: ['#ff0000', '#7f7fff', '#0000ff']
Loading…
Cancel
Save