OpenStreetMap logo OpenStreetMap

ypid's Diary

Recent diary entries

Approaching 1 million opening hours

Posted by ypid on 2 November 2017 in English.

We are pretty close to overcome the 1M (mega) count of opening_hours values in OSM. Also the amount of values which are machine readable is increasing from day to day. Almost all of those 1M values (97.8 %) follow the specification which greatly extends the use case of opening hours.

Thanks to all of you! 10 million is not far now :)


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 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:

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.

Dieser Blogbeitrag ist auch in Englisch verfügbar.

Eventuell hattest du die Öffnungszeiten Statistik-Seite, die als Begleitung für die aktuelle Wochenausgabe zu Öffnungszeiten erstellt wurde, ja schon mal offen. Die Statistik beschäftigt sich damit, wie viele opening_hours beziehungsweise verwandte Tags in OSM sind und wie viele davon ausgewertet werden können. Aber die wirklich interessante Frage ist doch, ob die Öffnungszeiten selbst visualisiert werden können, sodass Schlüsse daraus gezogen werden können. Auf diese Frage hat mich ein Kollege (noch kein Mapper) gebracht, als ich die Wochenaufgabe und die Statistik erwähnt hatte. Er frage, ob die Statistik etwas Nützliches darstellt wie zum Beispiel die Durschnittsöffnungszeiten von allen Geschäften in OSM. Das war etwas über das ich noch gar nicht nachgedacht hatte und ich fand die Frage ebenfalls interessant, also dachte ich etwas über die konkrete Umsetzung nach. Ich kam auf die Idee, die Prozentanzahl der geöffneten (unbekannt zählt als geschlossen) Geschäfte für einen gewissen Wochentag und Uhrzeit, wie es auch von GitHub für die Aktivität verwendet wird, darzustellen. Nachdem die Idee da war, konnte die Umsetzung nicht lange aufgeschoben werden :) Hier das Ergebnis:

Die Visualisierung der Wochenübersicht wird von einer JavaScript Bibliothek namens d3 erzeugt. Die Statistik wird täglich aktualisiert basierend auf allen Öffnungszeiten in OSM, sodass immer der Durchschnitt für die aktuelle Woche dargestellt wird. Dies umfasst auch Feiertage und andere unregelmäßige Ereignisse. Hier ist zu beachten, dass die Feiertage nur auf Deutschland zutreffen. Es ist aktuell nicht vorgesehen, die Auswertung automatisch auf den Standort des Abruferes der Statistik anzupassen, da diese Statistik mit einem gewissen Rechenaufwand verbunden ist. Variable Zeiten (wie Sonnenaufgang) werden für den Standort Baden Württemberg, Deutschland berechnet.

opening_hours statistics

Posted by ypid on 26 September 2014 in English. Last updated on 4 April 2015.

As I am looking forward to a “Wochenaufgabe” that involves the opening_hours tag, I saw the need for a statistical evaluation for that key. So I created one ;)

During development of the evaluation tool, I already wrote a JavaScript program which can go through all the values and show, how many can be evaluated, how many warnings occurred and how many values are equal to the prettified version that the evaluation tool generated. So I extended this script a bit to let it write that to a csv file. I installed a cron job which downloads the required data from the taginfo API on regular basis and evaluates it. I did not import history data. If anyone wants to do that, I would appreciate it. And finally, I created a nice (as I think) visualization based on the JavaScript library flot which you can check out here:

It shows the number of total values in the OSM database and the percentage of how many of those values can be parsed by opening_hours.js. You can also enable other layers of information if you want to.

So, lets push the percentage of the good values and the number of opening_hours to new highs ;) (I was running the script for a while before and the percentage of good values always stayed at 97 %.)

How to quickly find opening hours on websites

Posted by ypid on 15 September 2014 in English. Last updated on 30 April 2015.

As I often added opening_hours and sometimes had to search a bit on the websites. I thought why not letting Google do the searching for me ;)

Here is what I came up with. I am using this Google query:

"öffnungszeiten" OR "geschäftszeiten" OR "sprechzeiten" OR "opening hours" OR "orari" OR "orario" site:$website

and saved the query as bookmark and added a keyword to it in Firefox.

Now if I am at a website like and I can not find the opening hours right away I just select the location bar with Ctrl-L, hit the right arrow key, add my keyword (“go “ for google opening hours) and hit enter …

Find facilities which are missing an opening_hours tag but have a website tag

Posted by ypid on 8 September 2014 in English. Last updated on 16 September 2014.

I recently played a bit with the Overpass API, mainly to finally solve issue number 1 of the opening_hours_map. So I read the Overpass QL wiki page a few times and tried it. After a certain learning curve I now have understood all the basics of it. I have to say, if you work with OSM, knowing the overpass API and the ability to query for arbitrary constellations is a big advantage.

A couple of days after fixing the initial problem I thought about another use case. Since I have been working with opening_hours for some time now I came up with the idea of a query which shows facilities for which opening_hours could easily be added ;) So if your area looks all shiny on the opening_hours_map try running one of those queries ;)

The queries use a relatively new feature of the overpass API to search over keys with regular expressions: See issue 59.

Shameless self plug: If you do not know the evaluation tool yet, I would recommend to check it out since it makes this task so much easier. Just copy the opening hours from the website (check this blog post for how to find them quickly), add a few semicolons or other rule separators, copy the prettified value over to your editor and you are done …

So, lets add those missing opening_hours ;)