Automated edits/confusedbuffalo/Fix basic phone number issues
In short, the proposal is to automatically fix basic issues with phone numbers, such as missing country codes, inclusion of parentheses or certain other punctuation.
This can be expanded to other countries after further discussion with the relevant community. Create an issue on GitHub or send me a message on OSM if you think this proposal would work in your country.
Discussion
Canada
- Community forum post
- Submitted for WeeklyOSM 803
Switzerland
UK
- Community forum post
- Shared in WeeklyOSM 802
USA
Who?
I, confusedbuffalo will perform the edits using a dedicated bot account, confusedbuffalo-bot.
Contact me by OSM message or comment on the forum post if you have any questions.
Motivation
There are many phone numbers in OSM which are not in the agreed format, which includes a country code and excludes most punctuation, and such numbers keep being mapped. This makes it difficult to find actual issues with phone numbers, such as where a number has been transcribed incorrectly in a way that makes it invalid.
I have created the Phone Report website which suggests fixes to phone numbers and identifies invalid phone numbers. This has been in use over recent weeks to fix many phone numbers. Some of those changes are very simple and similar to each other and could be made automatically.
Making automatic changes in simple cases saves mappers' time and allows them to spend time on identifying and fixing actually invalid phone numbers.
Description
Object Selection
All objects with phone, contactːphone, mobile, contactːmobile, phoneːmobile, fax , contactːfax or contactːwhatsapp.
Edits
Edits will only be made if all of the following applyː
- The value in the phone tag consists of only digits, spaces, brackets (parentheses), dashes, hyphens, full stops (periods) or invisible formatting marks such as non-breaking spaces, zero-width spaces or other formatting marks.
- The value can be parsed using libphonenumber-js assuming the country that the object is in
- The new number is a valid phone number
- The new number has the same country code as the object is in
- The new number is different by more than just the addition or removal of spacing characters, for example a country code was added or punctuation was removed
- The OSM element does not contain any duplicate phone numbers
- The new phone number is not classified as a non-mobile phone number in a mobile tag
- And only if all of the above applies to every phone tag on the object
This is a subset of the suggested fixes on Phone Report, in particular it excludes any tag with multiple numbers, the duplicate and non-mobile number checks, any numbers with extensions or any with letters.
In the USA and Canada, the target formatting of the numbers would be +1-555-555-5555 after discussion with members of the US community.
Elsewhere, all spaces are used as separators, between the country code, area code and local numbers, using default formatting for the country.
For example, in the UK, +44 20 1234 5678 or +44 1904 123456.
Number of Objects Affected
USA
As of 2025-11-16, in the United States Of America there wereː
- 33,749 OSM objects with invalid phone numbers
- Of these, 31,530 have automatic fixes suggested on the website
- Of these, 28,656 would be made by this tool
Once the first edit has been done, it would be only objects that had been edited in the past day that would be affected, likely fewer than 10 per state per day.
UK
As of 2025-12-02, in the United Kingdom there wereː
- 387 OSM objects with invalid phone numbers
- Of these, 89 have automatic fixes suggested on the website
- Of these, 73 would be made by this tool
Once the first edit has been done, it would be only objects that had been edited in the past day that would be affected, likely fewer than 10 per day.
Canada
As of 2025-12-07, in the United Kingdom there wereː
- 73 OSM objects with invalid phone numbers
- Of these, 11 have automatic fixes suggested on the website
- Of these, 9 would be made by this tool
Once the first edit has been done, it would be only objects that had been edited in the past day that would be affected, likely fewer than 10 per day.
Grouping of Edits
Edits would be grouped by the divisions shown on the website.
For the US this would be by state, with up to one changeset per state per day.
For Canada this would be by province, with up to one changeset per province per day.
Examples of Edits that would and would not be made
Canada
Edits that would be made automatically by the bot
w307248561: phone=+1 (613) 564-1062 to phone=+1-613-564-1062
n12128712526: phone=(450) 332-3931 to phone=+1-450-332-3931
Edits that are suggested by the website but not made automatically
n13358601199 has multiple phone numbers. To be safe, objects with multiple phone numbers in one tag are not included in this proposal.
- phoneː
+1 (613) 828-7887; +1 (800) 818-5469 - suggested fixː
+1-613-828-7887; +1-800-818-5469
Full List of Edits
See here for the full list of edits that would be made by this proposal, as of 2025-12-07.
UK
Edits that would be made automatically by the bot
n1769294100: phone=020 7256 3240 to phone=+44 20 7256 3240
n697306695: phone=+4401200423267 to phone=+44 1200 423267
Edits that are suggested by the website but not made automatically
w156454940 has a number that looks like a landline in a mobile tag, which is suggested to move to the main phone tag. In this case, it is a textphone number which may need other tagging.
- mobileː
+44 3456 000 606 - suggested fixː
phone = +44 345 774 0740; +44 345 600 0606(appending the number to the existing phone value).
w219231501 the phone value has extra text, which technically makes the number invalid, but it is still parseable with libphonenumber.
- phoneː
+44 115 929 6251 'lower-school';+44 115 900 8624 'sixth form' - suggested fixː
+44 115 929 6251; +44 115 900 8624
Such cases could be considered valid, or could show that more detailed mapping would be needed.
Full List of Edits
See here for the full list of edits that would be made by this proposal, as of 2025-12-02.
USA
Edits that would be made automatically by the bot
n13298223257: phone=3349231048 to phone=+1-334-923-1048
w1450897471: phone=(256) 870-3424 to phone=+1-256-870-3424
Edits that are suggested by the website but not made automatically
n9947820920 has multiple phone numbers with an incorrect separator. To be safe, objects with multiple phone numbers in one tag are not included in this proposal.
- phoneː
+1 800 838 9647 / +1 800 835 4386 - suggested fixː
+1-800-838-9647; +1-800-835-4386
n2581950490 the phone value has extra text, which technically makes the number invalid, but it is still parseable with libphonenumber.
- phoneː
+1 605-397-8100 "non emergency calls" - suggested fixː
+1-605-397-8100
Full List of Edits
See here for the full list of edits that would be made by this proposal, as of 2025-11-16.
When?
This will be a recurring edit, with the script running once per day as part of the website creation process.
UK
The edit was announced on the forum on 2025-12-02 with a waiting time of at least 10 days (to 2025-12-12) for discussion.
USA
The edit was announced on the forum on 2025-11-16 with a waiting time of at least two weeks (to 2025-11-30) for discussion.
Changeset Tags
The following changeset tags will be used
comment: Division (Country)ː Automatically fix phone number issues: missing country code, extra punctuation, created_by: osm-phone-report/(version), bot: yes, automatic: yes, source_code: https://github.com/confusedbuffalo/phone-report/, osm_wiki_documentation_page: https://wiki.openstreetmap.org/wiki/Automated_edits/confusedbuffalo/Fix_basic_phone_number_issues, manual_review_neededː (link to relevant page on https://confusedbuffalo.github.io/phone-report/)
Source Code
https://github.com/confusedbuffalo/phone-report/
Opt out
If there is an element that you do not think should be edited for some reason then discuss with me and I would be able to exclude it.