Skip to content

fix(transit): link only stops named like the place to its board - #731

Merged
Medformatik merged 1 commit into
mainfrom
fix/transit-place-stop-linking
Nov 1, 2026
Merged

Medformatik merged 1 commit into
mainfrom
fix/transit-place-stop-linking

Conversation

@Medformatik

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #730. A place's departure board links stops by name, and the rule linked far too much. A stop within 1 km counted when it shared one "informative" word with the place. So "Köln Messe/Deutz" took in every Deutz stop: Suevenstraße, Koelnmesse, Im Rheinpark, Deutzer Freiheit, the Technische Hochschule. "Köln-Mülheim" took in most of Mülheim, and Stuttgart Stadtmitte took in Stuttgart Hauptbahnhof, 990 m away.

New rule. A stop within 1 km links when its name is the place's name: the same words in any order, after normalising spelling. Either name may leave out its town:

  • a leading town: "Köln Neumarkt" and "Neumarkt", "Messe/Deutz" and "Köln Messe/Deutz";
  • a town set apart by a comma: "Marienplatz, München".

Beyond that, a stop links only when its name says it is the station's own stop and contains the place's name: "Köln Dom/Hbf" and "Köln Breslauer Platz/Hbf" for Köln Hauptbahnhof, and "Köln Bf Deutz/Messe LANXESS arena" for Köln Messe/Deutz. Sharing a district or a town no longer links.

Details:

  • Spellings:
    • "Hbf", "Bf", "Bhf" and "Hauptbf" are read as the words they abbreviate.
    • "-str." is read as "-straße".
    • "Ostbahnhof" is read as "Ost", so "Ostbahnhof, München" is München Ost.
    • Bracketed parts, platform designations and S/U prefixes are ignored, as the board's stop labels already ignore them.
  • Places named like a town (Brühl, Bergisch Gladbach, Garmisch-Partenkirchen):
    • In "Brühl, Mitte" or "Rathaus, Garmisch-Partenkirchen", either part could be the town. So a comma isn't read as setting a town apart once at least three nearby stops begin with the place's name ("Brühl Mitte", "Brühl Nord", …).
    • The station itself still links ("Brühl Bf").

Before (main's rule): departures from Köln Deutz Im Rheinpark and Koelnmesse, which aren't part of the station.

Before: Köln Messe/Deutz board with departures from Köln Deutz Im Rheinpark and Köln, Deutz Koelnmesse

After: every departure leaves from the station or its "Bf Deutz/Messe" stop.

After: Köln Messe/Deutz board with departures only from the station's stops

Both views come from a local web build against a local proxy (not committed):

  • Stop candidates: the proxy used the candidates collected live for the place and linked them with main's or this branch's rule.
  • Departures: they came from openmapx.com, or straight from the HAFAS providers.

With main's rule the board had 643 departures, about half from those other stops; with this branch's it had 266. The "before" capture also shows the "Some departures may be missing" warning. The proxy didn't log per-stop lookups, so I can't say which of its extra stops failed to load.

Checked across Germany.

  • What ran: a local probe collected live stop-search candidates for 86 OSM stations and stops in 30 towns and cities, across Germany and the Ruhr. It used Transitous and the regional HAFAS providers with fix(transit): warn of missing departures only for sources that leave gaps #730's fixes. Both rules then linked the same candidates.
  • Totals: 1,260 links on main, 945 with this branch.
  • Removed, wrong:
    • Köln-Mülheim: 27 → 6 (Wiener Platz, Montanusstraße, Kieler Straße, …).
    • Köln-Ehrenfeld: 39 street stops.
    • Bonn-Beuel: 58 → 11.
    • Heidelberg Hbf: 31 → 10 (Czernybrücke, Stadtbücherei, …).
    • Bad Homburg: 13 town stops.
    • Hamburg-Harburg: Harburg Rathaus (930 m).
    • Mannheim Hbf: Paradeplatz and Wasserturm.
    • Dammtor: the city entry "HAMBURG".
  • Now linked, right:
    • "S+U Friedrichstr. Bhf", "S Südkreuz Bhf/Ostseite", the "S+U Alexanderplatz Bhf/…" stops.
    • Aachen Westbahnhof, "Südbahnhof/Mörfelder Landstraße" for Frankfurt Süd, "Max-Ernst-Museum/Brühl Bf".
  • Lost, accepted ("better too little than too much"):
    • Bus stops beside a station whose name doesn't say they belong to it, such as "Köln Bf Deutz/Messeplatz", "U Hermannplatz/Sonnenallee" and "S+U Zoologischer Garten/Jebensstr.".
    • RMV's "Heidelberg Bahnhof" for Heidelberg Hauptbahnhof.
    • Hauptbahnhof stops up to 540 m away still link when their name says Hauptbahnhof, such as Wuppertal's "Hauptbahnhof Historische Stadthalle".
  • Not covered: DB's own stop search (db-vendo) answered this machine with OPS_BLOCKED, so its spellings weren't in the probe. They follow the same patterns as the DELFI names Transitous returns.

Validation:

  • New tests cover:

    • the station under each source's spelling;
    • its own stops;
    • district and town stops not linking;
    • towns with and without a comma;
    • side-of-town stations;
    • main-station stops;
    • town-named places;
    • places sharing a last word;
    • the 1 km limit.

    Four fail against main's code. Two existing fixtures relied on the loose rule and now use names that link: the stop "Aachen Central" for the place "Aachen Hbf", and a bus stop "Köln Messe/Deutz Ottoplatz".

  • Full Vitest run: 24,554 passed, 0 failed. check-types passes for apps/api; pnpm lint (Biome, Prettier, translations) is clean.

  • Not run locally: the docs build. One paragraph of public-transit.md changed and passes Prettier.

Release and upgrade impact

Product impact: ordinary
No package release: neither @openmapx/extension-cli nor @openmapx/extension-contracts depends on the transit integration. Built with and without this change, their JavaScript output is byte-identical (42 files). The only differing files are integration.d.ts and licensing-schema.d.ts, whose union members come out in a different order between builds of the same source. Repeated builds of this branch alone show the same variation.

A place's board linked every stop within 1 km sharing one informative word
with the place, so Köln Messe/Deutz took in Deutz's street stops and
Köln-Mülheim most of Mülheim. Link a stop only when its name is the place's
name, with or without its town, or when it names the station as its own.
@Medformatik Medformatik added the integration New or changed provider, source or backend integration label Oct 31, 2026
@Medformatik Medformatik self-assigned this Oct 31, 2026
@Medformatik
Medformatik merged commit fa785e3 into main Nov 1, 2026
25 checks passed
@Medformatik
Medformatik deleted the fix/transit-place-stop-linking branch November 1, 2026 07:57
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

integration New or changed provider, source or backend integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant