Key:phone

From OpenStreetMap Wiki
Jump to navigation Jump to search
Public-images-osm logo.svg phone
Phone-number-on-a-shop.jpg
Description
A telephone number associated with the object. Use +CC XXX XXX XXX format, where CC is a country code. Show/edit corresponding data item.
Group: annotations
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
See also
Status: de facto

A telephone number associated with a POI. See also contact:phone=* for an alternative (less frequent) way of tagging phone numbers.

Summary

Sometimes it is useful to associate a phone number with an object, especially for business, leisure, or amenities. A shop, a museum, or a pub for example. The object can be on a node or an area. Clearly, phone is always an additional descriptive tag to be added alongside other more important tags which denote what the object actually is.

phone=* is widely used and accepted by many mappers but verify that you are not violating data privacy laws in your country (especially for private phone numbers).

Usage

  • phone=number where the number should be in international (ITU-T E.164) format
    • phone=+<country code> <area code> <local number>, following the ITU-T E.123 and the DIN 5008 pattern
    • (phone=+<country code>-<area code>-<local number>, following the RFC 3966/NANP pattern)
    • phone=+<country code> <area code> <local number>\;ext=<extension> is allowed by RFC3966 to specify a local extension as commonly used in office buildings, malls, universities and hospitals. Mind that it is \; which is called escaped semicolon (as opposed to an unescaped semicolon ; which is the separator for multiple phone numbers).

If your country does not use area codes, that part should be left out.

fax=number may be used in the same way as phone=*.

Spacing and separators

Some countries have very well-established national standards on how telephone numbers are written (e.g. xxx-xxx-xxxx in the US) which leads to mappers in those countries preferring that format over the aforementioned standards (but even in this case, the "+1-xxx-xxx-xxxx" format for the NANP standard should be explicit, to indicate that this phone number is callable internationally: OSM user agents should not have to guess how to perform a call according to geographic locations, or according to the value of the first 3-digit group).

Note that for phone numbers that are in international E.164 format, space (or even hyphen) separators are not significant, but the convention is to use a separator at least between the ITU-T country code and the rest of the phone number. The other groupings are optional: area codes should preferably be separated only in countries where they are still used distinctly for domestic calls; in other countries, the groupings are just kept by convenience and according to local usages in phone books or as shown in amenities (these groupings may vary for mnemonic reasons only, there's no requirement to suppress these group separators even if they are ignored when dialing).

This is true also when the phone number has additional digits for target selection (e.g. in Germany where there's a common public part, with variable size, followed by an internal short number which may be locally dialed directly without using any trunk selection code before composing the national number). For the purpose of OSM, we should assume calls are being performed from a public network and not from a private internal network, and the full number should work even when dialing this full number with the trunk selection code from a local network where the short number should also work.

The same remark about separators applies to phone numbers that are not in E.164 format (because they are not usable internationally and can be dialed only domestically, either nationwide, or only from a more specific network).

Only use object-specific emergency numbers

Some mappers started to add emergency numbers to police stations, hospitals, and fire stations (see also emergency:phone=*). This is fine as long as local numbers are used and the number is really bound to the object. You should not map objects with universal emergency numbers (e.g. 911 / 110 / 112) for local objects since this could result in non-emergency calls blocking real emergency calls when people try to reach a local police station, hospital, or fire station with non-emergency matters.

Phonewords

In some countries, businesses commonly use phonewords in posted phone numbers. phone=* should contain the numeric, fully resolved phone number for machine readability. Phonewords seen on signage etc. can go in phone:mnemonic=*, which could help search engines display the phone number more memorably. For example, "710-555-BEEF" would be tagged phone=+1-710-555-2333 phone:mnemonic=+1-710-555-BEEF and "55-KLICK" within the 710 area code would be tagged phone=+1-710-555-5425 phone:mnemonic=+1-710-55-KLICK. The word/s should always be in full capitals.

If you are adding a phoneword that can only be dialled from within that country e.g. a free call number, it should be tagged as phone:XX:mnemonic, where XX is the country code e.g. phone:AU:mnemonic=1300 THEIR NAME

How to map

Just add the phone=number tag to any map object that has a phone, following the format described above.

In case of multiple phone numbers, use phone=number;number as described in § Parsing phone numbers and Semi-colon value separator.

More specialized tags:

  • phone:mobile is sometimes used (As of 10 August 2022, 4564 uses according to Taginfo)
  • emergency:phone=* to associate a telephone number to be called in case of emergencies

Examples

The illustration shown in the top-right is a shop in the UK (code 44), in London (area 20), so could be tagged with phone=+44 20 8452 7891. An extension under that number would be tagged phone=+44 20 8452 7891\;ext=42.

Italy

Italy does not omit the 0 in the international format like many countries do (the "0" default trunk prefix may be replaced by a "trunk selection code" in calls from within the country, but only for phone numbers that have this selection feature enabled: not all national phone numbers have a trunk selection code, and some ranges of "short" numbers, not starting with the default "0" trunk code, may also be called internationally; so this default "0" trunk code must still be used when calling from abroad). So the Milan number 02.724261 becomes phone=+39 02 724261 in OSM. A few other countries are doing the same and require dialing the national trunk selection code when calling them from abroad.

United States

The most-preferred format for phone numbers in the US is +1 NXX-NXX-NXXX, following a Discourse discussion on the subject. For example, phone=+1 323-456-7890. This format allows for internationalization while keeping the area code and local number separate for US users who seldom encounter international dialing prefixes. Phone numbers in the United States and Canada consist of the following four elements: "+" (plus sign), the international country code (always 1), the area code, and the local telephone number. Phone numbers should not have parentheses around any of these number elements, including the area code, as is common in many local representations of phone numbers.

Phone numbers of telephone boxes

Even phone boxes have telephone numbers. Don't be confused. Telephone boxes must always be tagged with amenity=telephone to describe what the object is. You can add the phone=* tag to supply the extra detail of its telephone number (depending on how diligent you feel like being). But please take care: In Germany, public telephones do not have phone numbers anymore, because the service that they were callable has been discontinued.

An old example was: phone=+49 4721 28695 for a public phone box on the German island Neuwerk.

Parsing phone numbers

Clearly, it will be dangerous to assume that mappers have followed the above format correctly. Code using this tag might defensively reject or attempt to correct possible formatting errors. Specific things to note:

  • When dialling, the '-'-signs have to be omitted (mobile phones accept this character in their contact list, but ignore it when performing calls). The same is true for separating spaces or dots.
  • If the '+'-sign is not supported by the device, it has to be replaced by the local international call prefix; e.g., 00 in most countries, or 011 in US. The dialing device may have to be configured accordingly (this is normally not needed for mobile phone devices that automatically recognize the rules used by the local mobile operator and preconfigured in its SIM card or in the phone firmware).
  • The character ; can be used to separate multiple phone numbers.
  • An escaped semicolon \; can be present for adding RFC3966 parameters to the end of each number, such as the extension (\;ext=), an ISDN subaddress (\;isub=) or a phone context (\;phone-context=).

Support for multiple countries

Some amenities provide a different phone number for different countries (mostly seen when the amenity is on a country boundary, or is an international company).

One of the possible ways to solve this is by adding the ISO 3166-1 code at the end of the key. For example (all phone numbers below are invented only for documenting this page):

  • phone=+32 57 53 62 45 for the country where the amenity is,
  • phone:BE=+32 57 53 62 45 and phone:FR=+33 6 12654478 for different national phone numbers. Note that when using country codes, the convention is to make it uppercase, so it is not confused with a language code (but some mappers use lowercase instead).

Also some amenities have a local phone number which can only be used domestically not cannot be called internationally (notably for toll free phone numbers, or abbreviated phone numbers). For international calls, they publish another phone number. For example:

  • phone:FR=0 800 123 456 for standard toll free call only from France where the amenity is (note that there's NO "+" sign, it is NOT in international format),
  • phone=+33 1 23 45 67 89 when calling from any other country (note that it is not always possible to use it for domestic calls, or the toll free rate will not apply: users have to use the national number instead, they will most often be instructed by an automated vocal system: the most selective applicable key should be used; this means that OSM user agents should present the list of possible phone numbers, with their restrictions encoded in the subkey, to allow users to select which phone number to call, even if these agents preselect an applicable one).

Some phone numbers can also be called toll free (or with reduced rates) only when calling from a specific operator (such as customer services of that operator). When calling from another network, another national phone number or a standard geographic phone number must be used. For example, this could be tagged like this:

  • phone:FR:mobile:SFR=3000 for standard toll free call only from the SFR mobile network (operator in France), sometimes even when calling from abroad with roaming access (provided you use the same SIM card of that operator); note that there's also no "+" sign for this short number (this phone number is not valid internationally). (adjust the "FR:mobile:SFR" subkey of the tag according to the conventions used in that country).
  • phone:FR=0 810 123 456 for calls with flat rates from other networks only in France (still no "+" sign).
  • phone=+33 1 23 45 67 89 when calling from any other country or network (international toll rates apply according to the pricing plan of the originating operator).

Applications / Web services that display or dial the number from OSM

  • Offmaps (iPhone): Displays and dials the phone number in the app's downloadable City Guides.
  • OsmAnd: Displays and dials the phone number of all types of indexed POI.
  • Organic Maps: Displays and dials the phone number of all types of indexed POI.
  • Galileo Offline Maps: Displays and dials the phone number of all types of indexed POI.

Alternative tags

contact:phone=* has the same meaning for vast majority of tags, though some mappers used them with subtle distinctions.

Idea of deprecating either tags without contact: prefix or ones with contact prefix is repeatedly suggested, often triggering huge discussion and ending with conclusion that there is no consensus. Please, read past discussion before starting a new one[1][2][3][4].

Discussions/tagging/contact:phone or phone is a failed proposal to deprecate contact:phone=*.

Proposed features/Social media contact prefix is a similar attempt for facebook=*, twitter=* etc. deprecation in favor of contact: prefixed versions.

See also

External links

References