iD icon indicating copy to clipboard operation
iD copied to clipboard

opening hours form field

Open ansis opened this issue 11 years ago • 48 comments

http://wiki.openstreetmap.org/wiki/Key:opening_hours

ansis avatar Mar 11 '13 15:03 ansis

Should we have a cutoff for how many instances of a k/v are present before we specialize for it?

tmcw avatar Mar 11 '13 15:03 tmcw

This is basically either 24/7 or a variety of convoluted different types of syntax. Nixing.

tmcw avatar Mar 26 '13 14:03 tmcw

After seeing several new users adding their own business to OSM, I think it would be interesting to revisit this at some point by presenting a more complicated form that generated the correct opening_hours=* syntax. JOSM has a plugin that shows a timeline view (similar to GCal's "week" view) that lets you drag to select the times that you want to be open. GMM has a free-form text box for each day of the week.

iandees avatar Mar 28 '13 22:03 iandees

JOSM shows a dialog to let you edit an existing tag or add a new one:

Screen Shot 2013-03-28 at 5 19 37 PM

Then shows the calendar view:

Screen Shot 2013-03-28 at 5 19 56 PM

Dragged areas can cross day boundaries:

Screen Shot 2013-03-28 at 5 21 23 PM

iandees avatar Mar 28 '13 22:03 iandees

... here's an example node that someone added for their own car wash and typed in what made sense to them for P2's opening hours field:

http://www.openstreetmap.org/browse/node/2232512015

opening_hours = Mon-Fri 7:30AM- 6:00 PM Sat 9:00 AM- 3:00 PM

iandees avatar Mar 28 '13 22:03 iandees

I came up with a mockup of how this might look in iD:

id_opening_hours_box

So the idea is that you'd have a textbox at the top that people can enter whatever syntax they want into, and then the week calendar would update based on that. If the syntax doesn't match the rules of opening_hours, the javascript should autocorrect, and explain what was wrong (ie: if you put "Mon", it'll correct to "Mo", and give a message that says "Use two-letter weekday format".)

The problem with this UI design is it won't handle all features of the syntax. Here's some examples that it wont handle: Mo-Fr,Sa[1] 08:00-12:00 (Monday until friday and additionally on first saturday in months from 8 to 12.) Mo-Fr 08:00-12:00, PH off (Monday until friday from 8 to 12, except on public holidays.) Mo-Fr 08:00-16:00, Sa 10:00-14:00, Sa 14:00-18:00 "if weather permits " (The public pool extends its opening hours on saturdays to 18:00, if the sun shines. (external influence))

Also, whoever develops this out should make sure that the syntax rules follow the ones detailed here: http://www.netzwolf.info/en/cartography/osm/time_domain/ That site is linked from the opening_hours wiki page, and provides a very detailed specification of the syntax. It is also where I pulled all the examples above.

dkniffin avatar May 02 '13 18:05 dkniffin

I'm working on a parser that will work with the majority of data according to taginfo here. The goal is to cover most usecases but not destroy existing data. Based on this the form in iD would be a simple table with a 'day' column and 'open'/'close' columns.

iandees avatar May 02 '13 18:05 iandees

Hi all, just curious if opening times will be entered in the local timezone of the feature or in UTC? Depending, the editor may need to take the timezone in to account.

MarkBennett avatar Jul 20 '13 01:07 MarkBennett

OSM uses local time for the opening_hours tag.

iandees avatar Jul 20 '13 01:07 iandees

Maybe this library could be used to validate opening_hours and help the user to write a valid one.

ypid avatar Jan 12 '14 15:01 ypid

To elaborate a little bit more on this. I think the first step would be to make sure that the opening_hours values which make it into the changeset are valid. opening_hours.js is already used by JOSM. Please consider also using it in iD.

ypid avatar Sep 03 '14 11:09 ypid

Would love to see a pull request for this feature - it's a bit of an undertaking to build a full-fledged calendar interface as a small feature of a map editor.

tmcw avatar Sep 03 '14 12:09 tmcw

I don‘t think that someone who knows the iD code base would need more than 30 minutes to implement this. I would probably need longer …

ypid avatar Sep 03 '14 12:09 ypid

Yell.com has got a very good editor for opening hours. Image of Yaktocat Just use 7 sliders (one for every day) and add the labels for the times. I think the breaks are the more tricky part.

Week-planner looks good too. Screenshot of week-planner

brainscript avatar Sep 18 '14 17:09 brainscript

Any progress here? In the mean time maybe a link could be provided to simple instructions (a page like this) for the syntax. Many contributors just fill in something in natural language, which is useless to automated interpreters like OpenLinkMap and OsmAnd.

ghost avatar Mar 10 '15 19:03 ghost

Also another great alternative not mentioned yet is YoHours.

Maybe iD could give an hint to use one of these solutions when starting writing opening hours manually? It would not be a hard solution to implement right?

bagage avatar Aug 21 '15 18:08 bagage

It would not be a hard solution to implement right?

Please implement it, if you perceive it to be easy.

tmcw avatar Aug 21 '15 18:08 tmcw

Also another great alternative not mentioned yet is YoHours.

Maybe iD could give an hint to use one of these solutions when starting writing opening hours manually?

I just spent about 10 minutes playing around with it and it's unfortunately kind of buggy and hard to use. I do think it's probably a good starting effort though. If it were a bit more polished and could look nice in a lightboxed small dimension iframe, I'd consider it.

It would not be a hard solution to implement right?

I'm vetoing what @tmcw says above, this is too buggy to use currently and I wouldnt merge it. For now spend time improving the tool, but not on integrating it with iD.

bhousel avatar Aug 21 '15 18:08 bhousel

Also, supporting all the complex features behind the opening_hours tag language is nice, but the interface on YoHours is way too complex for iD. Limit to full (or half maybe) hours, don't expose the seasonal options, and only allow one tab to start. If someone wants to build more complex OH strings then they could switch to some advanced mode or something.

iandees avatar Aug 21 '15 19:08 iandees

@tmcw It was more of a question than an assumption, I would certainly not state on unknown technologies; my apologies if it looked like it. I just wanted to bump the issue since I found YoHours a bit earlier and found it valuable to map a swimming pool with seasonal opening hours which would have take me half an hour to do manually. I am not YoHours author at all, but considered it as easy enough to use in iD. It seems I was wrong :). At least it may help on what-to-do and what-not-to-do for iD widget.

bagage avatar Aug 21 '15 19:08 bagage

//cc @PanierAvide: would you like to comment on the issues raised by @bhousel above (https://github.com/openstreetmap/iD/issues/974#issuecomment-133526716)?

tyrasd avatar Aug 22 '15 07:08 tyrasd

Of course, so I'm the author of this buggy interface :) For the while it's not meant to be included in something else, but I was thinking of providing a simple HTML page which could be embed in an iframe. What would be the requirements to include this iframe in iD (dimensions, functionalities, show text input or not, how to expose result value...) ?

PanierAvide avatar Aug 22 '15 07:08 PanierAvide

I made a first attempt of a minimal embeddable version of YoHours. Things can still be smaller, and the seasons dialog content should be optimized. Let me know if it has any interest.

PanierAvide avatar Aug 24 '15 14:08 PanierAvide

@PanierAvide I will be happy to see yohours in iD.

Normally we want time table and columns with 24/7 and ("Monday"...) headers, Other settings are less popular and should be displayed as small tabs.

We may want to add more hover explanations to table in user language about how advanced features of opening_hours work. yohours contain no context-sensitive help or hover captions.

d1g avatar Nov 02 '15 07:11 d1g

Is there any hover caption system specific to iD, or something as simple as <a title="..."> can be used ?

PanierAvide avatar Nov 03 '15 08:11 PanierAvide

@PanierAvide I think it is ID-specific, You can test it with way tagged as highway=track. CSS class is "form-field-tracktype". Unlike html select it will:

  1. display shorter/trimmed title
  2. provide user with translated string when select box is opened

We will need hovers like this, but for calendar controls (sliders) or text fields (hover on opening_hours=24/7 will show "Open 24/7" in user language)

PS. We can annotate most OH strings in natural language, but it will be more demanding task.

d1g avatar Nov 06 '15 18:11 d1g

Any progress here? I think opening_hours is one of the most difficult days a Newbie encounter.

So iD should:

  1. Maybe at least validate the entered value, to prevent bad values
  2. (Later) offer a nice UI for editing it

Note that also Maps.me has a simple opening_hours editor, which works great for most cases.

rugk avatar Oct 11 '16 08:10 rugk

Any progress here? I think opening_hours is one of the most difficult days a Newbie encounter.

Indeed and as a newbie you probably aren't going to look into the wiki and see exactly how it's done. One I saw today from a new user was "Mon-Fri 0800 - 18.30, Sat 0800-1700, Sun 0800-1400" - a shame it was so close but not correct. I wonder if iD could do some basic validation, like checking for two letter days and time separator?

@bhousel here's a couple of examples:

google mapmaker desktop

Clicking on Mon-Sat gives you a dropdown which can be ticked, the hours also give a dropdown with half hourly times. hours

maps.me android

The advanced mode gives the normal alphanumeric field and some examples of the opening_hours format. maps

boothym avatar Jan 17 '17 21:01 boothym

To everyone commenting on this ticket. I don't need inspiration on how to design a date picker. The reason this field has not been built yet is not because I don't know what a date picker is, or know where to find one.

The problem here is that opening_hours is just a terribly complex grammar and iD needs to support most of it. For example, sunrise-sunset is currently the 8th most common value for opening_hours. If somebody edits a business already tagged with opening_hours=sunrise-sunset, what should this field show? We try very hard not to break existing data.

I do want to support this, but it's not as simple as dropping in a date picker.

bhousel avatar Jan 18 '17 04:01 bhousel

What if a day/time picker is only shown when the value of an existing object's opening_hours tag matched a regex that covers the "simple case"? e.g. Mo-Fr 09:00-17:00; Sa-Su 10:00-13:00. If it doesn't match such a regex, it shows the standard text box?

iandees avatar Jan 18 '17 04:01 iandees