User:M!dgard/Key:opening hours

From OpenStreetMap Wiki
Jump to navigation Jump to search
Public-images-osm logo.svg opening_hours
Neon Internet Cafe open 24 hours.jpg
Description
Describes when something is open or closed. There is a specific standard format for this data. Edit this description in the wiki page. Edit this description in the data item.
Group: Properties
Used on these elements
may be used on nodesmay be used on waysmay be used on areas (and multipolygon relations)may be used on relations
Documented values: 2
See also
Status: de facto

The opening_hours=* key allows you to indicate when a shop, amenity, or any other kind of facility is accessible to the public. In fact, every facility operates at different times: some supermarkets are open during the day, some gas stations are open 24/7, some pubs are open during night...

If this information is mapped, everyone can know when a facility is open, making it easier for example to find shops open during night or Sunday.

Additionally you can tag the URL where the current opening hours can be looked up with opening_hours:url=[http://example.org/ '"`UNIQ--nowiki-00000009-QINU`"'].

Syntax

This section is a quick tutorial to get you started with the opening hours syntax.

If you are a developer wanting to write a parser or generator for this key, see the full specification, which provides a complete overview of the syntax tailored to developers.

Simple

Image demonstrating to use a hyphen to separate the first and last weekday in the range, a space between the day range and the time interval, and noting that a leading zero is mandatory.

  • You should use the common English day abbreviations as in this table:
Abbreviation Day of week
Mo Monday
Tu Tuesday
We Wednesday
Th Thursday
Fr Friday
Sa Saturday
Su Sunday


Multiple opening intervals

opening_hours=Mo-Fr 08:00-12:00,13:00-17:30
same as above, but closed from 12:00 to 13:00 (noon to 1 PM)
  • Add the two time intervals in which they are open, separated by a comma (,).


Multiple days

opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00
same as above, also open on Saturday mornings
  • Add the opening hours for each day range, separated by a semicolon and space (; ).


Closed on holidays

opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00; PH off
same as above, but closed on public holidays
  • Use PH as if it were a weekday. Instead of hours, use off to say they're closed all day.
  • Use SH for school holidays. Although this is rare, you can also use both PH and SH on the same object, e.g. opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00; PH off; SH off


(optional reading) Different hours on holidays

opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00; PH 09:00-12:00
on holidays, they are open from 09:00 to 12:00
  • As said before, PH is just like a weekday. Because it is to the right of the rest of the rules, it overwrites them. For more information on which rules take precedence, see this more elaborate guide.


Further reading

To learn how to map more complex cases, you can read the detailed description of the opening hours syntax.

There's also a proposal (from 2012) that tried to describe the syntax for all time-related tags: also for other time-related properties such as the collection times of a post box.

A technical syntax definition, aimed at developers, can be found in the specification.

Extensive example

If you already know how to map opening hours but want a quick look at how a particular thing is expressed, you can look at this example that uses a lot of the syntax:

opening_hours=2015 Jan 12-2016 Jul 29 day 1-20 week 01-40/2 Mo,We-Fr 08:00-09:00 open "only vegetables",16:00-(sunset-01:00) || "on appointment"; PH off

Open from 12 January 2015 to 29 July 2016, but only on the 1st through the 20th day of the month, in weeks 1, 3, 5, ... 37, 39 of the year, but only on Mondays, Wednesdays, Thursdays, and Fridays: open from 8:00 to 9:00, but with comment "only vegetables", and open from 16:00 to one hour before sunset.

If the above does not match, use comment "on appointment", but on public holidays no appointments are accepted.

How to map

This is a property of other objects. It must go with a main tag describing what the object is, e.g.

Opening hours should not be used on roads; you are probably looking for conditional access restrictions.

Examples

Also check out the tutorial in which an example is fully worked out.

Here are some common examples of opening hours.


  • office=*
    opening_hours=Mo-Fr 09:00-18:00
    an office that is open every business day, from 09:00 to 18:00

Editors

To add the opening hours information on OpenStreetMap objects, you have several options:

  • Write it by hand in any editor, following the syntax definition above. You can validate it using the opening hours evaluation tool.
  • For JOSM users, you can install the OpeningHoursEditor, which displays a simple week calendar. It only supports a basic weekly scheme, and anything more complex can not be created with it.
  • You can use the website YoHours to create the opening hours value, and then paste the generated value in any OSM editor.

Implementations

See the Implementations sub-page for a list of websites, applications or libraries using opening hours.

Rendering

The default style (openstreetmap-carto GitHub) does not take into account this tag.

For a list of online maps showing opening hours, see Implementations § Online maps.

See also