Proposal:Charge:conditional with nested conditions and sequences

From OpenStreetMap Wiki
Jump to navigation Jump to search
charge:conditional with nested conditions and sequences
Proposal status: Draft (under way)
Proposed by: Zschoche
Tagging: charge:conditional=*
Applies to: node, way, area, relation
Definition: More powerful and compact syntax for charges with complex conditions
Statistics:

Draft started: 2026-03-30

Problem Statement

Tariff board with a common tariff, that can currently not be captured in OSM.

Parking tariffs often have complex conditions, which are (close to) impossible to encode correctly with the existing charge:conditional=* syntax.

In the example from the image on the right, there are different tariffs for day and night, the day tariff has varying prices over time, and there is a maximum price per day. Using the current syntax, one could attempt to capture this as follows:

charge:conditional = 2.50 EUR/hour @ 07:00-19:00; 2 EUR/hour @ (07:00-19:00 AND stay > 2 hours); 3 EUR @ 19:00-07:00; 16 EUR/24 hours

However, this is not correct: When the second condition matches, the specified value is 2 EUR/hour. So for a stay of three hours, the charge is specified to be 6 €. In reality it is 7 € – namely 5 € for the first two hours plus 2 € for one additional hour.

One could try to spell out the calculated prices for three, four, five, six and seven hours – each with the 07:00-19:00 restriction – but it is clear, that this is not practical.

Proposal

The proposal is to extend the syntax of charge:conditional=* so that

  • Conditions may be factored out – hence applying to multiple conditions at once
  • Sequences of charge specifications are allowed – for a simple specification varying charges

With the proposed syntax, the example above could be captured as

charge:conditional = @ 07:00-19:00 (2.50 EUR/hour|2.50 EUR/hour|2 EUR/hour); 3 EUR @ 19:00-07:00; 16 EUR/24 hours

or

charge:conditional = @ 07:00-19:00 (2 hours:2.50 EUR/hour|2 EUR/hour); 3 EUR @ 19:00-07:00; 16 EUR/24 hours

The proposed full syntax is as follows (fields in square brackets [..] are optional, three dots ... show where a list may be continued):

charge:conditional= <charge-conditional> [;  <charge-conditional> [; ...]]

where  <charge-conditional>  may be one of the following

 <charge> 
[ <for amount> :] <charge> |[ <for amount> :] <charge> [|...]
 <charge> @ <condition> 
@ <condition>  ( <charge-conditional> )


Rationale

Tagging

Examples

Impact on Data Consumers

Features/Pages affected

External discussions

Comments

Please comment on the discussion page.