Proposed features/simplified conditional restrictions language

From OpenStreetMap Wiki
Jump to: navigation, search

This proposal is a first draft trying to improve the current Extended conditions for access tags and access restrictions 1.5.


Both mentionned proposals have pros and cons. The major issues are:

- values are present in the key part of the tag. It's breaking the definition of a tag : a "key:value" pair. It's also creating an unlimited amount of keys making software consumers, developers (and statistic tools, editors and so on) hard life.
- for complex restrictions, the tag becomes quickly unreadable for humans and require an external software for parsing. Same for editing or creating such complex tags.


We have to follow some basic rules when we create new tags:

- tags must be readable for a wide public audience
- don't use software programming syntax or symbols (like ||, &&, ^, $, etc)
- the variable part (like speed limit or date or time) has to be on the value part of the tag
- complex conditional restrictions can be expressed therefore brackets can be used to group/subgroup expressions


Access tags already use keywords. Most of them are defined on the Key:access page like "car|foot|hgv", "yes|no", "destination", etc. We create the following new keywords which would enable a new "simplified conditinal restrictions language" (SCRL) parser:

- and, or, not : logical operands used for combining several conditions. e.g. motor_vehicle=condition1 or condition2

- in : link a value like a speed limit or a height to a condition. e.g. maxspeed=120 or (80 if condition1)

- condition : a named condition for an access restriction. The keyword can be followed by a number e.g. condition1, condition2, etc. The tag condition=* defines the condition and can be used as a 'variable' in other tags present on the same OSM element. It is a mean to split long expressions to smaller but multiple tags. e.g. condition1=Mo-Fr 16:00-18:00 + hgv=condition1 instead of hgv=Mo-Fr 16:00-18:00.

(to be enhanced if required)


  • No motor vehicles mon-fri between 1600-1800 except agricultural vehicles and good vehicles "in this direction". Going the other way the sign is similar but the times are between 0600 and 0900.

access=yes (this implies "agricultural=yes" and "goods=yes")
condition1=Mo-Fr 16:00-18:00
condition2=Mo-Fr 06:00-09:00
motor_vehicle:forward=not condition1
motor_vehicle:backward=not condition2
motor_vehicle:forward=not(Mo-Fr 16:00-18:00)
motor_vehicle:backward=not(Mo-Fr 06:00-09:00)

  • no motor vehicles except for loading/unloading by hgvs between 8pm and 10am

condition1=loading // improving current 'destination'
hgv=condition1 and not condition2

  • access:lgv.speed=120 + access:lgv?wet.speed=80

maxspeed:lgv=120 or 80 if condition1