How many amenities are open at a given time?
Posted by ypid on 30 April 2015 in English. Last updated on 30 March 2016.This blog post is also available in German.
You might know the opening_hours statistics page which was created for the current weekly task about opening hours on http://blog.openstreetmap.de/. The statistic is all about how many opening hours and related tags are in the dababase and if they are machine readable. But the really interesting question is can those opening_hours itself be visualized so that you can draw conclusions from it? This question occurred to me after I mentioned the weekly task and the statistics page to a colleague of mine (not yet a mapper). He asked if this statistic does actually show something useful for example the average opening hours of all amenities in OSM. This was something I had not thought about but I also found this question interesting. So I thought about how this can be visualized. I came up with the idea of showing the percentage of open (unknown counts as closed) amenities for a given time of the week as known from GitHub activity punchcards. After the idea was there the implementation could not wait long :) And here it is:
http://openingh.openstreetmap.de/stats/
The visualization of the punchcard is done using a JavaScript library called d3. The statistic is refreshed daily based on all opening_hours tags in OSM so it always shows the average for the current week so public holidays and such irregularities are considered but note that the public holidays might not be the public holidays which apply to you (the public holidays for Germany are used). It is currently not planed to adopt this to the visitor’s public holidays because of the data processing involved in this statistic. Also note that variable times like sunrise are calculated for this particular location: Baden Württemberg, Germany.
Discussion
Comment from SK53 on 30 April 2015 at 10:53
Nice thoughts.
I think the graphs are confusing because of the variable axes. In practice the vast majority of entries are parsable. I’d suggest making the % axis from 0-100, and perhaps adding another line showing total parsable entries using the right axis.
What I dont get a feel of is how many elements might have opening hours tags on them vs those that dont: for instance most shop=* might be expected to be valid elements for opening_hours.
Another thing which one might be able to pick up, in Germany at least, is the local Ruhetag, just from which day typically has different opening hours in an area.
Comment from ypid on 30 April 2015 at 19:29
Thanks very much for the comment. To the variable axes. That is done (actually it is the default of the flot library) do highlight the difference better. If I change the scale to 0-100 then you basically see one straight line for the parsed values in %. The variable axes might be confusing at first but I hope that it is understandable after some time. But your are free to try the your proposed changes: https://github.com/ypid/opening_hours-statistics
To your second remark. That would be quite nice to have a percentage value expressing the coverage of the opening_hours values in OSM. I might look into this later …
The thing with the closing days in Germany is interesting. I am going generate the punchcard data for all boundaries tonight. I first thought that I would not be worth it because it shows very similar data but now I will enable this as well. Should be online tomorrow. You can already see that for Monday and Wednesday there are less open amenities.
Comment from joost schouppe on 1 May 2015 at 08:55
Interesting idea. It might be interesting for practical use, like what are the common opening hours for banks or supermarkets in a given area (e.g. use the most common value for closing time). Or if you go city tripping, you might want to know if there’s anything to do on a Sunday. Or if you’re In city government and want workers to stick around after their shift ends, you might want to follow up on how many shops stay open after 5 pm. All the more important to map more POIs, with their opening times.
Comment from ypid on 1 May 2015 at 09:21
Thanks very much for the idea. I agree that it would be practical to break this down to individual amenities, shops … All the required data for this is already downloaded from the overpass API. I will look into this later :)
For the following questions: I would recommend http://osm24.eu which can answer this already. Hint: osm24 allows you to change the time and date.
Comment from morray on 1 May 2015 at 17:07
Hi, nice visualization, but what’s wrong Thursday night? I doubt that Thursday night is the night there openings double with respect to other nights. The only explanation would be Arabic and Judaic cultures with their different weekendweekends. But then still the nights of Friday and Saturday should show an increased opening. In the end I guess there is buried some kind of bug.
Comment from ypid on 1 May 2015 at 17:35
A bug is definitely possible, I just did not yet find one. You can have a look at it. All the source code is online. I also expected a slightly different result. I already looked into the Th night issue, see German Forum. You can see a slightly increased percentage of open amenities on Friday and Saturday evening (23:00).