From OpenStreetMap Wiki
Jump to: navigation, search

We should depreciate the "mm" format.

As the simple "mm" format can be quite ambiguous (could just as well be hours), we should recommend "hh:mm". That format also aligns better with the iso standard. --Gorm 15:47, 30 June 2012 (BST)


This tag is recognized at for ferries. At least the hh:mm format is supported. Proper tagging of duration on ferries ensures that they are chosen where this is natural, instead of choosing a long detour to avoid the ferry.

The OSRM router uses a very conservative speed of 5km/t for vehicle ferries. It is not unusual for large conventional vehicle ferries to have a normal speed of 10-15km/t or more.

OSRM is now supporting ISO8601 format. source: Kerosin (talk) 17:25, 2 March 2015 (UTC)

Time format

I don't like the format hh:mm because this conflicts with the format for the time of day as used by other keys like opening_hours=* or conditional=*. In order to be consistent, it would be better to use the same format for a duration as specified for maxstay=*. So instead of using <duration=08:00> it would be better to write:

This would even make it possible to use the easily readable 'Time and date' condition, e.g.:

(And no, I don't think using ISO 8601 is a good idea. I suppose that my example in ISO 8601 format would be written like this <duration:conditional=PT5M @ (08:00/18:00); PT7M @ (18:00/19:00)>. The precision is the same but it took me more than 5 minutes to figure this out. My conclusion is that ISO 8601 is not intuitive enough.) --Biff (talk) 23:52, 2 June 2016 (UTC)

The ISO 8601 is nice because it's non-ambiguous, but ya, at first glance it looks too intimidating and is hard to read. I don't like the ambiguous x:y format because it could be HH:MM or MM:SS. I like the idea of a hybrid ISO8601 standard which would use lower case units for the time (ie h,m,s for hour,minute,second) then the 'T' can be removed. So like 1 day 3:40:30 would look like 1D 3h40m30s. And there could be spaces between for readability. But point is I don't think there should be a single format so long as it's unambiguous. Make the parser conform to the contributors, not the reverse. The linux date and sleep commands are awesome like that. The other point is to make it very fast an intuitive to understand the format just by looking at the table of examples (which as it stands is most certainly not). DFyson (talk) 03:58, 21 March 2017 (UTC)

x:y means x hours y minutes. The Linux date format is just a nightmare due to localization. The ISO format on the other hand is simple and readable. Yes you need to get used to. Once. But like for opening_hours with, programs can be added to give a user friendly interface. D is English for Day. Not T for Tag or J for Jour. ISO format is international and already user friendly for Asia where DDDD-MM-JJ is common. When based on a norm, you have tools to parse the duration into a duration in the wanted language and you just pass the initial duration or even the ISO string to a duration picker which enable you to display and possibly update the duration in a user friendly manner as you would do with a date (you can type a date or pickup a date). Please don't change a norm into a non sense preventing proper UI in 99% of the tools, ask for better editors!
--Nospam2005 (talk) 20:11, 21 March 2017 (UTC)

ISO 8601 standard

I think the 'P' suffix should be dropped because it adds more confusion and complexity and it's redundant because it's implied by the fact it's a value of the duration tag. I can understand in other cases it would be important where it's not clear if it might be a time or a duration. DFyson (talk) 03:58, 21 March 2017 (UTC)

No! Without P it means a time, not a duration! Keep the norm, otherwise it's a unparsable stuff in the sens that it would need extra work for the machine and wouldn't be obvious to the human either. A human being can read and understand a norm. Not 75 because you don't like a letter which is not necessary if you create a specific norm just for duration in OpenStreetMap.
--Nospam2005 (talk) 19:57, 21 March 2017 (UTC)
But duration is implied so it's impossible to have any confusion. Having a time in the duration tag wouldn't make any sense. I think extra work for the machine should be encouraged if it means simplicity for the user (quality being equal). I'm not suggesting replacing the ISO 8601 standard but to document both to accommodate the occasional user. Another point to consider is peoples editing habits. I guarantee you people will omit the 'P' because they either forgot, or haven't read this and doing whatever is intuitive to them. So I think the best option is to adapt reasonably well to people's intuition so long as there is no ambiguity and it's still machine readable. If we did a poll, I bet you duration='5m' would universally understood whereas duration='PT5M' would create plenty of confusion except for those savvy to the ISO 8601 standard.
DFyson (talk) 18:10, 22 March 2017 (UTC)
You're making a hypothesis which IMHO should be wrong: editing a period with a text editor.
Back to the 80s, it would have been fine ;-). Nowadays only geeks prefer this kind of UI and can deal with ISO format.
On the other hands most users prefer a user friendly user interface like this one:
FR-fr PeriodPicker.png
Intentionally in a foreign language. Here on the top you've the user friendly textual description (Toutes les 2 semaines = every second week). and with the circles you edit the period (1/2/3... on the left) and the unit (here daily, weekly, monthly).
The textual output clarifies if biweekly or every second week is meant.
Because ISO 8601 is a standard, you can search for let say "javascript duration picker" and you find ready to use UI. Very simple for the guy making an editor on OSM data using a duration as key. Very simple to check validity also (not less than 3 ready to use duration modules on NodeJS). If you set a specific duration format you need every body (including non English speakers) to deal with a specific textual representation. Even if your previous time format proposal is a good way to deal with textual representation, it remains a non user friendly way to enter a duration - long to type, error prone for non English speakers. If you say "duration values are ISO8601 durations" you defines unambiguously what you expect and editors can easily provide support for that.
With a half human readable representation you make the validation much harder (understand: reinvent the wheel - here for instance add a P if not present then parse as ISO8601) and more error prone.
IMHO, everywhere there is a wide accepted norm, and ISO 8601 is such a format, it should be used. "Home made" formats should be used only in other cases.
5 meters for a duration, that's strange ;-) (remember, in OSM the default unit is meter and m is the abbreviation for meter (min is for minutes, except with hms related formats).
--Nospam2005 (talk) 20:45, 22 March 2017 (UTC)
Ya that's a good point about the editors especially with different languages. You've convinced me to stick to a strict ISO standard in the OSM database. It makes sense to keep the database standardized and move the burden of human readability to the human interface. However I'm using JOSM, ID, and Vespucci and all of them are raw text entry. So I suspect there will still be problems with people putting in what is intuitive for them unless they read the wiki. Thus someone will likely need to create a cleanup script for the duration=* tags.
DFyson (talk) 21:50, 22 March 2017 (UTC)
You just proved the impact of a picture compared to a text. I never said it was so simple. But a direction to take. If we consider JOSM, ID, Vespucci, and other variants they are all based on Java or Javascript (Potlatch is written in flash which has a JavaScript API), so if we say we should accept any PT* form of the ISO 8601, we should be able to edit / display those durations properly.
For the existing values, I guess JOSM has a checker for validation, others probably too, if not they should, so any valid representation should be parsed into an internal representation and outputted as ISO 8601 string.
That's very similar to the behavior of if you feed it with a too complex value, it just checks for validity and says it can't turn it into a graphical representation but that it is a valid representation (or not). For instance;%20Sa,Su%2016:00-20:30;%20PH%20off.
If we decide to stick to ISO 8601, then we can propose this migration path to the main editors maintainers and publish the proposal including the migration path (in order to avoid conflicts similar to the one that happened with the transport schemes).
--Nospam2005 (talk) 22:26, 22 March 2017 (UTC)
I would have been convinced without the picture, but it can help. What really got me is the idea of keeping the database standard and transitioning the human readability (which includes language support) to the user interface side. It seems more logical, beneficial and pretty universally standard for other databases. Previously I was convinced the database entries should contain human readable content because most of the editors directly edit that value and don't have an interface to translate it to something more human readable. And I'm still fine with people putting whatever they want in the tag if it's not obvious or don't know any better. It just means potentially cleaning it up later and apps which have strict parsers might have unusable data until it is cleaned up. None of the editors validate it either. I think really it just comes down to deciding on a philosophy for data management and sticking with it. Just for future reference, I've opened tickets for iD, Vespucci, JOSM, and JOSM OpeningHoursEditor plugin.
DFyson (talk) 23:47, 22 March 2017 (UTC)