OSM WebTagger
| OSM WebTagger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Author: | Henning Jacobs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| License: | MIT License (free of charge) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Platform: | Cross-platform | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Status: | Active | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Version: | 0.1.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Language: | English
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Source code: | https://codeberg.org/hjacobs/osm-webtagger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Programming language: | Python | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Command-line tool that extracts missing OSM tags from a POI's own website (opening hours, phone, email, social profiles, address, and family facilities on German-language sites) and emits them as an OSM Preflight batch for human review. Never edits OSM itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
OSM WebTagger (command: webtagger) is a command-line tool that extracts information from a point of interest's own website and emits the tags that are missing in OpenStreetMap as a batch for OSM Preflight, where a human reviews each proposal before anything is uploaded.
WebTagger never edits OpenStreetMap. Review and upload happen in Preflight, one changeset per proposal, under the reviewer's own account.
OSM WebTagger is a community tool, not affiliated with the OpenStreetMap Foundation.
Extracted tags
| Source on the POI's website | Proposed tags |
|---|---|
| Opening hours (text, tables, schema.org JSON-LD) | opening_hours
|
Phone numbers (tel: links, JSON-LD, imprint/contact pages) |
phone or contact:phone (mirroring the element's existing scheme)
|
Email addresses (mailto: links, JSON-LD, imprint) |
contact:email
|
| Social media profile links (Instagram, Facebook, YouTube, Twitter/X, TikTok, LinkedIn) | contact:instagram, contact:facebook, contact:youtube, contact:twitter, contact:tiktok, contact:linkedin
|
| Address (JSON-LD + imprint, gated — see Safety rules) | addr:street, addr:housenumber, addr:postcode, addr:city and regional equivalents
|
| Family facilities, German-language sites only (DE/AT/CH) | kids_area + kids_area:indoor / kids_area:outdoor, changing_table + changing_table:location
|
Regional support: contact, social and opening-hours extraction work worldwide; address formats are implemented for DE/AT/CH, the US, Canada and Australia; the family-facilities extractor is German-language only (DE/AT/CH).
Safety rules
These rules are non-negotiable and enforced in code:
- First-party source only — the POI's own website (the one linked from its OSM element). No search engines, no aggregators, no third-party directories.
- Missing-only — a tag is proposed only if the OSM element lacks it. An extracted value that differs from an existing tag is written to the run's report, never to a proposal.
- No quote, no proposal — every proposed value traces to a verbatim quote or a concrete link on the site; the quote becomes the evidence shown in Preflight.
- Validators are gates — opening hours must compile and validate (via ohx, see Dependencies), phone numbers must parse, email addresses must validate, and social URLs must be profile-shaped (share/post links are excluded).
- Conflicts are report-only — two different values for one tag, chain pages listing several locations, and PO Box addresses never produce proposals.
- Address gate —
addr:*is proposed only when two independent signals agree (for example JSON-LD and imprint text), or when the extracted postcode/city/street is consistent with tags already on the element. - Crawling etiquette —
robots.txtis honoured and requests per host are throttled. Bot walls (HTTP 401/403/429) are classified as blocked, not as errors or link rot. - Deterministic — no LLM is involved; extraction is structured-data first, then deterministic text patterns.
How it works
- fetch — finds every node/way/relation in a bounding box with
website=*orcontact:website=*via Overpass API (tiled and checkpointed). For larger areas, pbf streams a Geofabrik.osm.pbfextract offline instead and keeps the same POIs. - crawl — per POI, fetches the homepage plus up to four same-host subpages whose link text or URL suggests opening hours, contact, imprint or location information. Pages are cached locally; failures are classified.
- extract (offline) — per field, in trust order: schema.org JSON-LD,
tel:/mailto:/social links, then visible text including the imprint. Opening hours come from ohx, run per cached page and merged (identical results collapse; differing results are a conflict). Extractors produce findings — field, value, verbatim quote, source URL and confidence — and never see the OSM tags. - decide + emit — the only step that sees both sides: applies the missing-only filter, the
contact:-scheme mirroring, the conflict and address gates, and writesproposals.jsonin theosm-preflight/1format plus a human-readablereport.md(proposals per field, differing values, conflicts, report-only findings, crawl failures). - submit — optionally posts the batch to the Preflight backend's inbox (private by default), where it waits for human review.
Usage
# one site, no OSM involved — show everything extractable
uv run webtagger probe https://example-cafe.de
# full dry run over a bounding box
# (fetch + crawl + extract + emit + validate)
uv run webtagger run --bbox 53.57,9.95,53.60,10.00 --workdir runs/eimsbuettel
# large areas: scan a Geofabrik .osm.pbf extract offline instead of Overpass
uv sync --extra pbf
uv run webtagger pbf --input germany-latest.osm.pbf --workdir runs/hamburg \
--bbox 53.39,9.73,53.74,10.33
# or step by step (network steps are checkpointed; extract/emit are offline)
uv run webtagger fetch --bbox 53.57,9.95,53.60,10.00 --workdir runs/eimsbuettel
uv run webtagger crawl --workdir runs/eimsbuettel
uv run webtagger extract --workdir runs/eimsbuettel
uv run webtagger emit --workdir runs/eimsbuettel
uv run webtagger validate --workdir runs/eimsbuettel \
--schema ../osm-preflight/public/proposals.schema.json
# submit the batch to Preflight's inbox (private by default)
OSM_PREFLIGHT_TOKEN=… uv run webtagger submit --workdir runs/eimsbuettel
Requires Python ≥ 3.11 and uv.
Evaluation
WebTagger is gated by a hand-labelled evaluation set before real batches are submitted. The runner scores the proposals against labels that are judged against the POI's website quote — never against OSM, whose state changes constantly (partly through this tool's own uploads) and therefore must not decide what enters the set. Exact matches (extraction equals the existing OSM tag) are a separate, labelable track and never enter proposal precision; differing values are scored separately again.
Gates: per-field precision ≥ 95% for high-confidence proposals, 100% verbatim evidence (the quote must be found in the cached source page), and 0 address proposals on multi-location POIs. A field that fails its gate ships as report-only.
Dependencies
Opening hours are the hardest field, so they are not reimplemented: WebTagger depends on ohx (opening-hours-extractor), which converts human-readable opening-hours text into valid opening_hours values. ohx is not on PyPI; it is declared as a git dependency on its Codeberg repository. Other dependencies: Typer, httpx, lxml, phonenumbers, email-validator; the optional pbf extra uses pyosmium.
Related tools
WebTagger is one of a small family of tools built around the same review-before-upload workflow:
- OSM Preflight — the review and upload step for WebTagger's batches.
- OSM SchemaLint — finds tag keys/values that deviate from the documented tagging schema, and emits Preflight batches.
- OSM WebsiteWatch — checks the websites of mapped POIs for link rot, and emits Preflight batches.