User:Kees 59/Notes

From OpenStreetMap Wiki
Jump to navigation Jump to search

Problem with fee:conditional syntax

Setting

Creating a parking fee only valid at specific time-frame. Initially I followed the syntax described on Tag:amenity=parking(Older version of the article} which stated

Whether you have to pay a parking fee or not. If the fee must be paid only on certain hours, the same syntax can be used as for opening_hours=*.

I used YoHours for the construction of the timings. Using the following tags:

  • fee=yes
  • fee:conditional=no @ Mo 00:00-09:00,18:00-09:00; Tu-Fr 18:00-09:00; Sa 18:00-24:00; Su 00:00-24:00

I used that in this changeset. When testing the result on Parking Lanes viewer this did not have the expected results.

Fault finding

I started checking the syntax used but could not find an error. After that I had a read of the Key:fee article. More or less hidden among the examples I found this note:

Note: although the syntax is similar to opening_hours=* there is a difference, for example:

Mo-Fr 09:00-19:00; Sa 09:00-13:00 (syntax in opening_hours)
yes @ Mo-Fr 09:00-19:00; yes @ Sa 09:00-13:00 (syntax in fee:conditional, after ";" the condition must be repeated).
yes @ Mo-Fr 09:00-19:00; Sa 09:00-13:00 (wrong syntax in fee:conditional).

This led me to the following tags:

  • fee=yes
  • fee:conditional=no @ Mo 00:00-09:00,18:00-09:00; no @ Tu-Fr 18:00-09:00; no @ Sa 18:00-24:00; no @ Su 00:00-24:00

This produced the wanted results.

I changed the English (Tag:amenity=parking) an dutch (NL:Tag:amenity=parking) to follow the text on Key:fee. The German version (DE:Tag:amenity=parking) did not mention how to do it at all.

Continued reading

The Conditional restrictions article said the following: <restriction-value> @ <condition>[;<restriction-value> @ <condition>] which is consistent with what the fee article is saying.

The article also mentions in the Condition section that:

This field specifies the condition for which the restriction applies. Conditions may include a semicolon, ;, and where they do must be enclosed with parentheses, (). It is suggested, by some, to simply do this always.

Various kinds of conditions can be distinguished:

  • Time and date: Use the standard opening hours syntax. Note the common occurrence of semicolons; e.g. (Mo 06:00-24:00; Tu-Fr 00:00-24:00; Sa 00:00-13:00), Mo-Fr 07:00-19:00, sunrise-sunset, or Jan-Mar.

    Comments, to be presented to the user directly, are allowed and should be written in local language. For example, "rowing events" and Mo-Fr 06:00-10:00,15:00-19:00 "bij grote verkeersdrukte". In the latter, the condition may apply within the specified time windows, but it certainly does not outside of them.

This following the opening_hours syntax but inside parenthesis. 20241025: This needs testing. Works on Parking Lanes viewer

Preliminary conclusion

There are 2 possible syntaxis for using fee:conditional on parking:

  • A- Repeated values -fee:conditional=no @ Mo 00:00-09:00,18:00-09:00; no @ Tu-Fr 18:00-09:00; no @ Sa 18:00-24:00; no @ Su 00:00-24:00
  • B- Using parenthesis - fee:conditional=no @ (Mo 00:00-09:00,18:00-09:00; Tu-Fr 18:00-09:00; Sa 18:00-24:00; Su 00:00-24:00)

Functioning

App Syntax Notes
A- Repeated values B - Parenthesis
Parking Lanes viewer yes yes 20241025: Renders different colors based on date/time(date and time can be set). Visible in pop-up on click.
CityParkingWeb - - 20241025: No rendering difference. Visible in pop-up on click.
mapcomplete parking 20241025: No rendering difference. Visible in pop-up on click. Shows parking_space when sufficiently zoomed in.
Parkraumanalyse mit OpenStreetMap 20241025: In German. Only specific German cities.
Traffic_signs and Parkin - Umap 20241025: Only highway + parking?