From 96ddf6dadcc54e487fd9102748b78131ac14b104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Wed, 4 Jan 2023 22:06:30 +0100 Subject: [PATCH] parking_lanes: add conditions and restrictions --- parking_lanes.yaml | 111 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 6 deletions(-) diff --git a/parking_lanes.yaml b/parking_lanes.yaml index 538952f..8efdc48 100644 --- a/parking_lanes.yaml +++ b/parking_lanes.yaml @@ -7,6 +7,63 @@ feature: {% set rightType = attribute(tags, 'parking:right')|default(attribute(tags, 'parking:both'))|default('unknown') %} {% set leftOrientation = attribute(tags, 'parking:left:orientation')|default(attribute(tags, 'parking:both:orientation'))|default('unknown') %} {% set rightOrientation = attribute(tags, 'parking:right:orientation')|default(attribute(tags, 'parking:both:orientation'))|default('unknown') %} + + {% set leftCondition = 'undefined' %} + {% if attribute(tags, 'parking:left:fee')|default(attribute(tags, 'parking:both:fee')) == 'no' %} + {% set leftRestriction = 'free' %} + {% endif %} + {% if attribute(tags, 'parking:left:maxstay')|default(attribute(tags, 'parking:both:maxstay')) not in [undefined, 'no'] %} + {% set leftRestriction = 'free_time_limit' %} + {% endif %} + {% if attribute(tags, 'parking:left:fee')|default(attribute(tags, 'parking:both:fee')) not in [undefined, 'no'] or attribute(tags, 'parking:left:fee:conditional')|default(attribute(tags, 'parking:both:fee:conditional')) matches '/yes/' %} + {% set leftRestriction = 'paid' %} + {% endif %} + {% if attribute(tags, 'parking:left:access')|default(attribute(tags, 'parking:both:access')) == 'customers' or attribute(tags, 'parking:left:access:conditional')|default(attribute(tags, 'parking:both:access:conditional')) matches '/customers/' %} + {% set leftRestriction = 'customers' %} + {% endif %} + {% if attribute(tags, 'parking:left:access')|default(attribute(tags, 'parking:both:access')) == 'no' or attribute(tags, 'parking:left:access:conditional')|default(attribute(tags, 'parking:both:access:conditional')) matches '/no/' %} + {% set leftRestriction = 'non_public' %} + {% endif %} + {% if attribute(tags, 'parking:left:disabled')|default(attribute(tags, 'parking:both:disabled')) not in [undefined, 'no'] or attribute(tags, 'parking:left:disabled:conditional')|default(attribute(tags, 'parking:both:disabled:conditional')) %} + {% set leftRestriction = 'disabled' %} + {% endif %} + {% if attribute(tags, 'parking:left')|default(attribute(tags, 'parking:both')) == 'no' and attribute(tags, 'parking:left:reason')|default(attribute(tags, 'parking:both:reason')) %} + {% set leftRestriction = 'reason' %} + {% endif %} + {% for r in ['charging_only', 'loading_only', 'no_parking', 'no_standing', 'no_stopping'] %} + {% if attribute(tags, 'parking:left:restriction')|default(attribute(tags, 'parking:both:restriction')) == r or attribute(tags, 'parking:left:restriction:conditional')|default(attribute(tags, 'parking:both:restriction:conditional')) matches ('/' ~ r ~ '/') %} + {% set leftRestriction = r %} + {% endif %} + {% endfor %} + + {% set rightCondition = 'undefined' %} + {% if attribute(tags, 'parking:right:fee')|default(attribute(tags, 'parking:both:fee')) == 'no' %} + {% set rightRestriction = 'free' %} + {% endif %} + {% if attribute(tags, 'parking:right:maxstay')|default(attribute(tags, 'parking:both:maxstay')) not in [undefined, 'no'] %} + {% set rightRestriction = 'free_time_limit' %} + {% endif %} + {% if attribute(tags, 'parking:right:fee')|default(attribute(tags, 'parking:both:fee')) not in [undefined, 'no'] or attribute(tags, 'parking:right:fee:conditional')|default(attribute(tags, 'parking:both:fee:conditional')) matches '/yes/' %} + {% set rightRestriction = 'paid' %} + {% endif %} + {% if attribute(tags, 'parking:right:access')|default(attribute(tags, 'parking:both:access')) == 'customers' or attribute(tags, 'parking:right:access:conditional')|default(attribute(tags, 'parking:both:access:conditional')) matches '/customers/' %} + {% set rightRestriction = 'customers' %} + {% endif %} + {% if attribute(tags, 'parking:right:access')|default(attribute(tags, 'parking:both:access')) == 'no' or attribute(tags, 'parking:right:access:conditional')|default(attribute(tags, 'parking:both:access:conditional')) matches '/no/' %} + {% set rightRestriction = 'non_public' %} + {% endif %} + {% if attribute(tags, 'parking:right:disabled')|default(attribute(tags, 'parking:both:disabled')) not in [undefined, 'no'] or attribute(tags, 'parking:right:disabled:conditional')|default(attribute(tags, 'parking:both:disabled:conditional')) %} + {% set rightRestriction = 'disabled' %} + {% endif %} + {% if attribute(tags, 'parking:right')|default(attribute(tags, 'parking:both')) == 'no' and attribute(tags, 'parking:right:reason')|default(attribute(tags, 'parking:both:reason')) %} + {% set rightRestriction = 'reason' %} + {% endif %} + {% for r in ['charging_only', 'loading_only', 'no_parking', 'no_standing', 'no_stopping'] %} + {% if attribute(tags, 'parking:right:restriction')|default(attribute(tags, 'parking:both:restriction')) == r or attribute(tags, 'parking:right:restriction:conditional')|default(attribute(tags, 'parking:both:restriction:conditional')) matches ('/' ~ r ~ '/') %} + {% set rightRestriction = r %} + {% endif %} + {% endfor %} + body: | Left: