Key:opening_hours

From OpenStreetMap Wiki
(Redirected from Opening hours)
Jump to: navigation, search
Available languages
Public-images-osm logo.svg opening_hours
Neon Internet Cafe open 24 hours.jpg
Description
Describes when something is open or closed.
Group: Properties
Used on these elements
may be used on nodes
may be used on ways
may be used on areas
use on relations unspecified
Documented values: 1
See also
service_times=* collection_times=*
Status: Unspecified

It is possible to enter opening hours for almost everything that has opening hours. Supermarkets and small convenience stores close in most countries at different times (even in the same city), in metropolitan areas there are often small shops open the whole night. Some pharmacies, gas stations, pubs and fast-food-restaurants are open 24/7. This is a very important information if you are looking for a certain facility at night.

Additionally you can tag the URL where the current opening hours can be looked up with opening_hours:url=http://example.org/.

Please be aware of these documents before reading this page: Proposed features/Time domains and Key:opening_hours:specification.

Simplified syntax diagram

This is an easier to read diagram covering most cases. Its goal is to allow writing most Opening Hours tags in a short time, not to explain the full syntax. For more complicated cases, please refer to the text below this section, to the full diagram and to more explanations.

Note: Anyone being sure to have understood something upon which everyone agrees and that's different from this diagram is welcome to make the diagram correction.

Legend:

  • <element> is to be replaced by the element's syntax definition below
  • boldcase is either written as such and explained below, or chosen from a list or numeric rule below
  • [...] means that ... is optional
  • [something]... means that something can be repeated as needed
  • this | that indicates that one of this or that must be chosen (alternative)

Syntax:

  • opening_hours = <range> [off] [;<range> [off] ]...
  • <range>: open | closed | <daily> | <weekly> | <montly>
  • <daily>: [ Mo [md[-md] [, md[-md]]... ] [ <period> [,<period>]... ]
  • <weekly>: [week we[,we...|-we[/n]]] Wd[-Wd] [ <period> [,<period>]... ]
  • <monthly>: <monthdays> [<weekdays>] [ <period> [,<period>]... ]
  • open: always open, initial state, except the overrides that follow
  • closed: never open, initial state, except the overrides that follow
  • off: closing time that overrides previous opening time
  • <period>: <time>-<time>
  • <time>: hh:mm | sunrise | sunset
  • <weekdays>: Wd[-Wd] [,Wd[-Wd]]... | Wd[x[,x]...] (e.g., Mo-Fr 08:00-09:00 or Mo[1,3] 08:00-09:00)
  • <monthdays>: Mo-Mo:
  • hh: hours note: always two digits number, in 24h format (no am/pm)
  • mm: minutes note: always two digits number (e.g., Fr 08:30-20:00)
  • Mo: Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec : month (e.g., Dec 25)
  • md: monthday note: always two digits number (e.g., Dec 25)
  • Wd: Mo | Tu | We | Th | Fr | Sa | Su : weekday (e.g., Fr 08:30-20:00)
  • we week number note: always a two digit number in range 01-53 (e.g., week 25 Mo 08:30-20:00)

How to map

This is a property tag so it must go with a related tag; e.g.,

Values

Before tagging ways Way, see Key:access.

The evaluation tool is a webtool which helps to determine the values. Please use English for weekday and month names.

Examples

  • opening_hours=24/7
    Applied to: any non-stop facilities (related tags), 24 hours a day, 7 days a week
    Render on map: something like object icon with a 24
  • opening_hours=Sa-Su 00:00-24:00
    Applied to: opens only the weekend but non-stop, 24h
  • opening_hours=Mo-Fr 08:30-20:00 or for more complex opening hours:
    opening_hours=Mo 10:00-12:00,12:30-15:00; Tu-Fr 08:00-12:00,12:30-15:00; Sa 08:00-12:00
    opening_hours=Mo-Su 08:00-18:00; Apr 10-15 off; Jun 08:00-14:00; Aug off; Dec 25 off
    Applied to: any facilities with opening hours (related tags)
    Render on map: nothing, info recovered by software
  • opening_hours=Mo-Sa 10:00-20:00; Tu off or opening_hours=Mo-Sa 10:00-20:00; Tu 10:00-14:00
    For exceptions in a range of days
    Applied to: any facilities with opening hours (related tags)
    Render on map: nothing, info recovered by software
  • opening_hours=sunrise-sunset
    Applied to: opens every day between sunrise and sunset.
    Use round brackets to add a time offset, for example a park that opens 2 hours after sunrise and closes 2 hours before sunset (sunrise+02:00)-(sunset-02:00)
  • opening_hours=Su 10:00+
    Sunday from 10:00 to an unknown or unspecified closing time.
    Applied to: any facilities with opening hours (related tags)
    Render on map: nothing, info recovered by software
  • opening_hours=week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00
    Open from 09:00 to 12:00 on Fridays of odd weeks and on Wednesdays of even weeks
    Applied to: any facilities with opening hours (related tags)
    Render on map: nothing, info recovered by software
  • opening_hours=Mo-Sa 08:00-13:00,14:00-17:00 || "on appointment"
    Here does the fallback rule come in handy. It applies for any time which was not handled by previous rules.
  • opening_hours=Su-Tu 11:00-01:00, We-Th 11:00-03:00, Fr 11:00-06:00, Sa 11:00-07:00
    Because of the definition that following rules will overwrite previous once, times which span over midnight have to use additional rules which are separated by comma instead of semicolon.

Syntax

  • wd weekday, available: Mo · Tu · We · Th · Fr · Sa · Su (e.g., > Fr 08:30-20:00)
  • hh hour, always two digits number in 24h basis (no am/pm), in the format "hh:mm" · (e.g., > Fr 08:30-20:00)
  • mm minute, always two digits number in the format "hh:mm" (e.g., > Fr 08:30-20:00)
  • mo month, available: Jan · Feb · Mar · Apr · May · Jun · Jul · Aug · Sep · Oct · Nov · Dec · "mo md" (e.g., > Dec 25)
  • md monthday, always two digits number in the format · "mo md" (e.g., > Dec 25)
  • we week number, always a two digit number in range 01-53, in the format "week we" (e.g., > week 25 Mo 08:30-20:00)
  • SH School Holiday, can be used to indicate different opening hours during school holidays (e.g., Mo-Fr 08:00-09:00,14:00-15:00; SH off)[1]
  • PH Public Holiday, can be used to indicate different opening hours during public holidays (e.g., Mo-Fr 09:00-17:00; PH 10:00-12:00; PH Su off)[1]
The above example means normal hours are Monday to Friday 9am to 5pm, except on public holidays it is 10am to 12pm, except public holidays that fall on a Sunday.

The general syntax for the value is: hh:mm-hh:mm (e.g., > 08:30-20:00)

The general syntax for the value is: wd hh:mm-hh:mm (e.g., > Fr 08:30-20:00)

The general syntax for the value is: mo md: hh:mm-hh:mm (e.g., > Dec 25: 08:30-20:00) Note that the colon is optional as mentioned under Key:opening_hours:specification

The general syntax for the value is mo-mo: wd hh:mm-hh:mm (e.g., Jun-Aug: Su 10:30-16:00 to specify the opening times on Sundays in June, July and August. Note that the colon is optional as mentioned under Key:opening_hours:specification).

The general syntax for the value is: week we: wd hh:mm-hh:mm (e.g., > week 25: Mo 08:30-20:00) Note that the colon is optional as mentioned under Key:opening_hours:specification

Rules

  • Consecutive hours [always needs open-close] separated by "-" · (e.g., > 08:30-20:00)
  • Consecutive weekdays open separated by "-" · (e.g., > Mo-Fr)
  • Consecutive monthdays open separated by "-" · (e.g., > Dec 20-26) or (e.g., > Dec 20-Jan 06)
  • Open with periodicity "n" within a range of consecutive monthdays, the range is followed by "/n" (e.g., > 02-30/n)
  • Consecutive weeks open separated by "-" · (e.g., > week 01-26)
  • Open with periodicity "n" within a range of consecutive weeks, the range is followed by "/n" ( e.g.> week 02-52/n )
  • A break on days separated by "," · (e.g., > Mo,We,Fr)
  • A break on hours separated by "," · (e.g., > 08:30-14:00,16:30-20:00)
  • Different hours on different days are separated by ";" (e.g., > Mo 10:00-12:00,12:30-15:00; Tu-Fr 08:00-12:00,12:30-15:00; Sa 08:00-12:00)
reads as: this opening hours for this days ; this opening hours for this days
  • A weekday off will be tagged as "wd off" (e.g., > Tu off)
  • A range of weekdays off will be tagged as "wd-wd off" (e.g., > Tu-Th off)
  • A month off will be tagged as "mo off" (e.g., > Aug off )
  • A range of months off will be tagged as "mo-mo off" (e.g., > Aug-Sep off)
  • A monthday off will be tagged as "mo md off" (e.g., > Dec 25 off)
  • A range of monthdays off will be tagged as "mo md-md off" (e.g., > Dec 24-26 off) or "mo md - mo md off" (e.g., > Dec 25-Jan 06 off )
  • Exceptions to a range of days, first the range then the exception (e.g., > Mo-Sa 10:00-20:00; Tu off) or (e.g., > Mo-Sa 10:00-20:00; Tu 10:00-14:00) or (e.g., > Mo-Fr 08:00-12:30; We 14:00-17:00)
This means these are not additions, for example Mo-Fr 08:00-12:30; We 14:00-17:00 means that on Wednesdays, the shop is only opened in the afternoons and not additionally.
  • If it is in the first or last day of a range then don't use the exception rule, use the usual (e.g., > Mo-Fr 10:00-20:00; Sa 10:00-14:00)
  • Non-consecutive or semi-consecutive days of the week will be tagged as wd[x] (e.g., Su[3] 09:00-12:00)
This is used to indicate the 3rd Sunday of the month from 9am to 12pm.
Use -1 to indicate the last day of the month; e.g., Aug Th[-1] means last Thursday in July.
Can use grouping, (e.g., Su[1,3,5] and Su[1-3])
  • If hours are non stop some days then (e.g., > 00:00-24:00)
  • If it is 24 hours 7 days a week it has a specific value: 24/7
this way it can render a specific icon.
  • A special time value to mark the time the sun rises is: sunrise.
  • A special time value to mark the time the sun sets is: sunset.
  • A + after a time means "from" or "open end" (e.g., Sa 22:00+ or Sa 18:00-22:00+)

See the formal specification for more details.

Common mistakes

  • opening_hours=7/8-23 (incorrect) → opening_hours=Mo-Su 08:00-23:00 (correct)
  • opening_hours=0600-1800opening_hours=06:00-18:00
  • opening_hours=07;00-2;00pmopening_hours=07:00-14:00
  • opening_hours=08.00-16.00, public room till 03.00 a.mopening_hours=08:00-16:00 open, 16:00-03:00 open "public room"
  • opening_hours=09:00-21:00 TEL/072(360)3200opening_hours=09:00-21:00 "call us" (and add contact:phone=*)
  • opening_hours=10:00 - 13:30 / 17:00 - 20:30opening_hours=10:00-13:30,17:00-20:30
  • opening_hours=April-September; Mo-Fr 09:00-13:00, 14:00-18:00, Sa 10:00-13:00 -> opening_hours=Apr-Sep: Mo-Fr 09:00-13:00,14:00-18:00; Apr-Sep: Sa 10:00-13:00
  • opening_hours=Dining in: 6am to 11pm; Drive thru: 24/7 -> opening_hours=06:00-23:00 open "Dining in" || 00:00-24:00 open "Drive-through"
  • opening_hours=MWThF: 1200-1800; SaSu: 1200-1700 -> opening_hours=Mo,We,Th,Fr 12:00-18:00; Sa-Su 12:00-17:00
  • opening_hours=BAR: Su-Mo 18:00-02:00; Tu-Th 18:00-03:00; Fr-Sa 18:00-04:00; CLUB: Tu-Th 20:00-03:00; Fr-Sa 20:00-04:00 -> opening_hours=Tu-Th 20:00-03:00 open "Club and bar"; Fr-Sa 20:00-04:00 open "Club and bar" || Su-Mo 18:00-02:00 open "bar" || Tu-Th 18:00-03:00 open "bar" || Fr-Sa 18:00-04:00 open "bar"
  • opening_hours=Su-Th 11:00-03:00; Fr-Sa 11:00-05:00 -> opening_hours=Su-Th 11:00-03:00, Fr-Sa 11:00-05:00 See last example
  • opening_hours=Mo-We 17:00-01:00; Th,Fr 15:00-01:00; PH,Sa,Su off -> opening_hours=Mo-We 17:00-01:00, Th,Fr 15:00-01:00; PH off. Use additional rules. You can not say "Sa,Su off" because that would set the time "Sa 00:00-01:00" to closed.

Implementation

JavaScript implementation by User:Ypid:

JavaScript library by User:AMDmi3 (on which the work from User:Ypid is based on).

Code

Rendering

In the case of opening_hours=24/7 it can be something like adding a 24 to the object icon.

Pharmacy dispencing 24.png

The rest of values have no obvious rendering and may be accessed with context menu or alike.

Implementations

OsmAnd

OsmAnd uses this tag in the POI search screen. The colour of the arrow changes when the POI is open, closed or the state is unknown (no opening_hours=* defined). The implementation is only partial, currently no dates, weeknumbers or holidays are supported, but most values should get parsed.

Source code is hosted here: OpeningHoursParser.java

Screenshot of Osmand 0.8.1 taken on 2012-07-27 showing the feature of displaying the direction arrows in green or red (or grey if unknown) depending of the tagging of opening_hours on each object in the raw OSM data.


OpenLinkMap

OpenLinkMap creates a clickable POI overlay over an osm based slippy map. Clicking on a POI opens a dialog window showing informations about it, including its opening hours and open/closed state

Openlinkmap-opening hours-screenshot.jpg


Opening hours for Ulm, Neu-Ulm & surroundings

The web application is available on http://oeffnungszeiten.ulmApi.de. Opening hours for the local area are visualized on a map. The source code of this application is freely licensed and available via GitHub. Adapting the application to a different city is very easy and described on the GitHub page.

Ulm-oeffnungszeiten.jpg


More Maps and Applications

See also

Notes

  1. 1.0 1.1 The default holidays can be added to opening_hours.js. There is an alternative system for default values which is currently not evaluated by opening_hours.js: Default is a proposal for a default values system. This proposal can set default values such as maxspeed for areas (countries, states...) but also holidays periods. A country, a zone area can subscribe to a default containing such holidays definitions.