"""Rebuild this repository from the live study at https://getalistof.com/local-digital-gap/.
python3 scripts/build.py # charts + README from the files in data/
python3 scripts/build.py --fetch # download the current CSV + JSON first
Standard library only. The numbers in README.md and charts/ are computed from data/, never typed by hand.
"""
import csv
import io
import json
import math
import statistics
import sys
import urllib.request
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
DATA = ROOT / "data"
CHARTS = ROOT / "charts"
SITE = "https://getalistof.com"
STUDY = SITE + "/local-digital-gap/"
FILES = ("local-digital-gap.json", "local-digital-gap.csv")
SURFACE, INK, INK2, MUTED, GRID, BAR, BAR2 = "#fcfcfb", "#0b0b0b", "#52514e", "#8a8984", "#e6e5e0", "#2a78d6", "#eb6834"
FONT = "Helvetica, Arial, sans-serif"
def fetch():
DATA.mkdir(exist_ok=True)
for name in FILES:
req = urllib.request.Request(f"{SITE}/data/{name}", headers={"User-Agent": "local-digital-gap-repo/1.0"})
body = urllib.request.urlopen(req, timeout=60).read()
if name.endswith(".json"):
json.loads(body) # refuse a broken download
else:
rows = list(csv.reader(io.StringIO(body.decode("utf-8-sig"))))
if len(rows) < 100:
raise SystemExit(f"{name}: only {len(rows)} rows, refusing")
(DATA / name).write_bytes(body)
def esc(s):
return str(s).replace("&", "&").replace("<", "<").replace(">", ">").replace('"', """)
def text_w(s, size):
"""Rough rendered width of Helvetica/Arial text (enough to keep labels from colliding)."""
narrow = sum(1 for ch in s if ch in "il.,:;'|!()[] ")
wide = sum(1 for ch in s if ch in "MWmw@%")
return size * (0.56 * (len(s) - narrow - wide) + 0.3 * narrow + 0.85 * wide)
def n(x):
return f"{x:,}"
def bar_chart(path, title, subtitle, rows, source, xmax=100):
"""Horizontal bars, one series, 0-xmax%. rows: (label, pct, note)."""
label_w = max(text_w(r[0], 13) for r in rows) + 16
note_w = max(text_w(r[2], 12) for r in rows) + 60
plot_w = 520
W = int(24 + label_w + plot_w + note_w + 24)
row_h, bar_h, top = 24, 16, 96
H = top + row_h * len(rows) + 64
x0 = 24 + label_w
out = [f'")
path.write_text("\n".join(out) + "\n", encoding="utf-8", newline="\n")
def scatter(path, title, subtitle, pts, xlab, ylab, source, label_names):
"""pts: (name, x_pct, y_pct, size). Both axes 0-100; labels only for label_names."""
W, H, L, R, T, B = 760, 640, 76, 40, 96, 92
pw, ph = W - L - R, H - T - B
lo = 20
def sx(v):
return L + pw * (v - lo) / (100 - lo)
def sy(v):
return T + ph * (1 - (v - lo) / (100 - lo))
out = [f'")
path.write_text("\n".join(out) + "\n", encoding="utf-8", newline="\n")
def overlap(a, b):
return a[0] < b[2] and b[0] < a[2] and a[1] < b[3] and b[1] < a[3]
def gate_text(path):
"""Build gate: no two text labels in a chart may overlap, and none may leave the canvas."""
import re
svg = path.read_text(encoding="utf-8")
W = float(re.search(r'width="([\d.]+)"', svg).group(1))
boxes = []
for m in re.finditer(r']*)>([^<]*)', svg):
x, y, size, txt = float(m[1]), float(m[2]), int(m[3]), m[5]
a = re.search(r'text-anchor="(\w+)"', m[4])
anchor = a.group(1) if a else "start"
w = text_w(txt.replace("&", "&"), size)
x0 = x if anchor == "start" else x - w if anchor == "end" else x - w / 2
box = (x0, y - size * 0.8, x0 + w, y + size * 0.2, txt)
if box[0] < 0 or box[2] > W:
raise SystemExit(f"{path.name}: label {txt!r} leaves the canvas")
for b in boxes:
if overlap(box, b):
raise SystemExit(f"{path.name}: labels {txt!r} and {b[4]!r} overlap")
boxes.append(box)
def human_date(iso):
y, m, d = iso.split("-")
months = "January February March April May June July August September October November December".split()
return f"{int(d)} {months[int(m) - 1]} {y}"
def build():
d = json.loads((DATA / FILES[0]).read_text(encoding="utf-8"))
rows = list(csv.DictReader(io.StringIO((DATA / FILES[1]).read_text(encoding="utf-8-sig"))))
t = d["totals"]
kinds = sorted(d["byKind"], key=lambda k: (-k["noWebsitePct"], -k["places"]))
cities = [c for c in d["byCity"] if c["places"] >= 200]
countries = sorted(d["byCountry"], key=lambda c: -c["noWebsitePct"])
upd = human_date(d["updated"])
ext = f"{human_date(d['extractFrom'])} to {human_date(d['extractTo'])}"
src = f"Source: OpenStreetMap contributors (ODbL), extracts {ext}. getalistof.com/local-digital-gap"
CHARTS.mkdir(exist_ok=True)
bar_chart(CHARTS / "no-website-by-kind.svg",
"Local businesses on OpenStreetMap with no website on their record",
f"Share of named records with no website tag, by kind of business. {n(t['places'])} records, {t['cities']} cities, {t['countries']} countries; kinds with 200+ records.",
[(k["name"], k["noWebsitePct"], f"{n(k['noWebsite'])} of {n(k['places'])}") for k in kinds], src)
bar_chart(CHARTS / "no-website-by-country.svg",
"No website on the map record, by country",
"Share of named business records with no website tag, all kinds together, in the cities covered.",
[(f"{c['name']} ({c['cities']} {'city' if c['cities'] == 1 else 'cities'})", c["noWebsitePct"], f"{n(c['noWebsite'])} of {n(c['places'])}") for c in countries], src)
xs = [c["noWebsitePct"] for c in cities]
ys = [c["noPhonePct"] for c in cities]
r_phone = statistics.correlation(xs, ys)
r_hours = statistics.correlation(xs, [c["noHoursPct"] for c in cities])
r_size = statistics.correlation(xs, [math.log(c["places"]) for c in cities])
lo_c = min(cities, key=lambda c: c["noWebsitePct"])
hi_c = max(cities, key=lambda c: (c["noWebsitePct"], c["places"]))
def strength(r):
r = abs(r)
return "closely" if r >= 0.7 else "clearly" if r >= 0.5 else "loosely" if r >= 0.3 else "barely"
def link(r):
r = abs(r)
return "strong" if r >= 0.7 else "clear" if r >= 0.5 else "weak" if r >= 0.3 else "close to nothing"
big = sorted(cities, key=lambda c: -c["places"])[:6]
named = {c["name"] for c in big} | {lo_c["name"], hi_c["name"]} | {c["name"] for c in sorted(cities, key=lambda c: c["noWebsitePct"])[:3]}
scatter(CHARTS / "website-vs-phone-by-city.svg",
"Cities whose records lack websites also lack phone numbers",
f"{len(cities)} cities, one dot each (size = named business records). Pearson r = {r_phone:.2f}.",
[(c["name"], c["noWebsitePct"], c["noPhonePct"], c["places"]) for c in cities],
"No website on the record", "No phone on the record", src, named)
for svg in CHARTS.glob("*.svg"):
gate_text(svg)
top = d["biggestGaps"][:8]
ctry_rows = "\n".join(f"| {c['name']} | {c['cities']} | {n(c['places'])} | {c['noWebsitePct']}% | {c['noPhonePct']}% | {c['noHoursPct']}% |" for c in countries)
gap_rows = "\n".join(f"| {g['category']} | {g['city']} | {n(g['noWebsite'])} of {n(g['places'])} | {g['noWebsitePct']}% | [list]({SITE}{g['listPath']}) |" for g in top)
k_hi, k_lo = kinds[0], kinds[-1]
social = t["socialOnly"]
header = list(rows[0].keys())
readme = f"""# The local digital gap: OpenStreetMap business records in {t['cities']} cities
**{n(t['noWebsite'])} of {n(t['places'])} named local businesses on OpenStreetMap have no website on their map record ({t['noWebsitePct']}%).**
{t['noPhonePct']}% have no phone number and {t['noHoursPct']}% no opening hours. The records cover {t['kinds']} kinds of business
in {t['cities']} cities across {t['countries']} countries, from OpenStreetMap extracts of {ext}.
This repository holds the data behind the study at **[getalistof.com/local-digital-gap]({STUDY})**: one row per
city and kind of business ({n(len(rows))} rows), the summary JSON, the charts below and the script that builds them.
Last numbers change: {upd}.

{" and ".join(k['name'] if i == 0 else k['name'].lower() for i, k in enumerate(k for k in kinds if k['noWebsitePct'] == k_hi['noWebsitePct']))} lead the list ({k_hi['noWebsitePct']}% with no website listed); {k_lo['name'].lower()} have the fewest gaps
({k_lo['noWebsitePct']}%). The single largest pile is {top[0]['category'].lower()} in {top[0]['city']}: {n(top[0]['noWebsite'])} of
{n(top[0]['places'])} list no website.
## Read this before quoting a number
"No website listed" means the map record has no `website`, `contact:website` or `url` tag. It does not mean the business
has no website. A volunteer simply has not added one yet.
The city numbers show how much of the gap is about the map itself. Across the {len(cities)} cities, the share of records
with no website tracks the share with no phone number {strength(r_phone)} (Pearson r = {r_phone:.2f}) and the share with no
opening hours {strength(r_hours)} (r = {r_hours:.2f}). Its link to how many businesses a city has mapped is {link(r_size)} (r = {r_size:.2f} against the log of the count).
Where mappers fill in contact details, they tend to fill in all of them; where they mostly add a name and a shop
type, all three stay blank.

So a high share in {hi_c['name']} ({hi_c['noWebsitePct']}%) next to a low one in {lo_c['name']} ({lo_c['noWebsitePct']}%) says at least as much about
local mapping habits as about local businesses. Compare kinds of business within one city, or cities within one country,
before comparing across countries. Only {n(social)} records ({social / t['places'] * 100:.1f}%) point to a social or directory
page instead of the business's own site.
## By country

| Country | Cities | Named businesses | No website | No phone | No opening hours |
|---|---:|---:|---:|---:|---:|
{ctry_rows}
## Largest gaps
City lists with the most named businesses and no website on their record:
| Kind of business | City | No website listed | Share | The list |
|---|---|---:|---:|---|
{gap_rows}
Every city has its own breakdown at `{STUDY}/`, and each row of the CSV links to the free list it was counted from.
## Files
| File | What it holds |
|---|---|
| [`data/local-digital-gap.csv`](data/local-digital-gap.csv) | one row per city and kind of business: {", ".join(f"`{h}`" for h in header)} |
| [`data/local-digital-gap.json`](data/local-digital-gap.json) | the same counts rolled up by kind, city and country, plus the largest and smallest gaps (cells under {d['thresholds']['cellMin']} records are left out of the rankings) |
| [`charts/`](charts) | the three charts on this page, as SVG |
| [`scripts/build.py`](scripts/build.py) | downloads the current files from the study (`--fetch`) and rebuilds the charts and this README; standard-library Python |
## Method
- **What counts as a business:** a named OpenStreetMap record inside the city's boundary, tagged as one of {t['kinds']} kinds
of business. Records without a name are left out. A chain's branches count like any other business.
- **Website listed:** a `website`, `contact:website` or `url` tag pointing to the business's own site. A record whose only
link is a Facebook, Instagram, link-in-bio, booking or directory page counts as "social or directory page only".
- **Phone and opening hours:** a `phone`, `contact:phone` or `contact:mobile` tag, and an `opening_hours` tag.
- **Boundary:** the one OpenStreetMap holds for the city; some lists cover a metro area, and each list page says which.
- **Freshness:** each city is rebuilt from a fresh extract about once a month. The study is recomputed with every
rebuild and this repository follows it; the date above moves only when a number changed.
Counts are records on the map, not a census of businesses. Check any single business before you act on it.
## Licence and credit
The data is derived from OpenStreetMap and is available under the
[Open Database License 1.0](https://opendatacommons.org/licenses/odbl/1-0/) (see [`LICENSE`](LICENSE)).
- Credit: **© OpenStreetMap contributors**, and link to the study: {STUDY}
- Share-alike: if you publish an adapted version of this data, keep it under the ODbL.
- The charts and text in this repository may be reused with the same credit.
Cite as:
> Get a List Of (2026). The local digital gap: websites, phone numbers and opening hours of {n(t['places'])} local businesses
> on OpenStreetMap, {t['cities']} cities. Updated {upd}. {STUDY}
Published by the people behind [getalistof.com]({SITE}), which turns the same OpenStreetMap records into free
"list of shops in a city" CSVs. Found a mistake in a count? Say so on the dataset's discussion page. Found a business with a wrong or missing
website? Fix it on [openstreetmap.org](https://www.openstreetmap.org/), and the next monthly rebuild picks it up.
"""
(ROOT / "README.md").write_text(readme, encoding="utf-8", newline="\n")
cff = f"""cff-version: 1.2.0
message: "If you use this data, credit OpenStreetMap contributors and cite the study."
title: "The local digital gap: websites, phone numbers and opening hours of local businesses on OpenStreetMap"
type: dataset
authors:
- name: "Get a List Of"
website: "{SITE}"
url: "{STUDY}"
doi: "10.5281/zenodo.24197424"
license: ODbL-1.0
date-released: "{d['updated']}"
keywords: [openstreetmap, local businesses, open data, websites, digital divide]
"""
(ROOT / "CITATION.cff").write_text(cff, encoding="utf-8", newline="\n")
print(f"built: {len(rows)} rows, {t['places']} places, updated {d['updated']}, r_phone={r_phone:.2f}")
if __name__ == "__main__":
if "--fetch" in sys.argv:
fetch()
build()