Matching engine E.4.1
Stop problems
On this page
Stop problems describe single stops: a match that is too far apart, a stop without a counterpart, attributes that disagree, duplicates, a match that contradicts the route evidence, a disused OSM element that still needs attention, or an OSM identifier that cannot be trusted. This page lists every rule and how it sets the priority. E4 explains how the rules are run and the indexes they share.
| Problem type | Means | Priorities | Checked on |
|---|---|---|---|
distance |
The matched stops are far apart | P1, P2, P3 | Matches |
unmatched |
A stop has no counterpart | P1, P2, P3 | Unmatched entities |
attributes |
Matched stops disagree on a reference, name, platform code or operator | P1, P2, P3 | Matches |
contradicts_route_matching |
The match conflicts with the stops' routes | P2 | Matches |
duplicates |
A dataset contains the same stop twice | P2, P3 | All |
disused |
An OSM element marked out of service still looks like a stop to the source or to data users | P1, P2 | Disused OSM elements |
identifier |
An OSM element's identifier, such as ref:sloid, names a far or unknown stop, or is malformed |
P1, P2, P3 | Active OSM elements with an identifier tag |
Detection evaluates every normalised entity. Adapters have already validated identities and coordinates, so (0, 0) is treated as a real position, never as a missing one.
Distance problems
A matched pair is too far apart: either the match is wrong or one dataset has an imprecise position. The rule reads the stored distance_m and the source stop's operator.
The thresholds come from the profile's distance_priorities, by default 80, 25 and 15 m:
| Priority | Condition |
|---|---|
| P1 | More than 80 m, and the operator is not exempt |
| P2 | More than 25 m, up to 80 m, and the operator is not exempt |
| P3 | More than 15 m, up to 25 m; or more than 15 m for an exempt operator |
| none | 15 m or less |
Operators listed in distance_priority_exempt_operators never get P1 or P2: in the Swiss profile, SBB, whose large stations have long platforms. The check compares the source stop's operator abbreviation (servicePointBusinessOrganisationAbbreviationEn for ATLAS) without regard to case. For example, a match 85 m apart is P1 for a PostAuto bus stop but P3 for an SBB platform.
Unmatched problems
Every source stop and OSM element without a match gets one, with two exceptions: the middle of a two-sided stop whose sides are matched, and a disused OSM element, which can get a disused problem instead. The priority depends on whether a counterpart exists at all and how close the nearest one is.
Source stops:
| Priority | Condition, first that applies |
|---|---|
| P1 | The stop has a station reference that no OSM element carries |
| P1 | The nearest OSM element is more than 80 m away, or there is none |
| P2 | The nearest OSM element is more than 50 m away |
| P2 | The UIC number has a different count of OSM platforms than of source stops |
| P3 | Otherwise: there are candidates nearby |
OSM elements:
| Priority | Condition, first that applies |
|---|---|
| P1 | The element has a station reference that no source stop carries |
| P2 | The nearest source stop is more than 50 m away, or there is none |
| P2 | The UIC number has a different count of OSM platforms than of source stops |
| P3 | Otherwise |
The 80 m threshold is the first value of distance_priorities, the 50 m threshold the profile's isolation_radius. Station references are only considered when the profile allows them. The same radius sets the bundle's isolated flag; the review application shows isolated source stops as "No OSM < 50m".
Attribute problems
Matched stops whose attributes disagree. One problem is created per match, with the priority of the most severe disagreement:
| Priority | Disagreement | Compares |
|---|---|---|
| P1 | Station reference | SourceStop.station_ref and OsmNode.station_ref, exactly; only when the profile allows station references for the stop |
| P1 | Name | SourceStop.name and the first available tag of problem_name_tags: uic_name in the Swiss profile, name then uic_name by default |
| P2 | Platform code | SourceStop.platform_code and OsmNode.local_ref |
| P3 | Operator | SourceStop.operator and OsmNode.operator |
A field is compared only when both sides have a value. Names, platform codes and operators are compared without regard to case.
Contradicts route matching problems
A match whose own route evidence disagrees: the stop and the OSM element both belong to routes, but not to the same ones. The rule uses the same comparison as the GTFS route rule:
| Priority | Condition |
|---|---|
| P2 | Both sides have route and direction tokens, and they share none |
| P2 | Both sides have direction names, and they share none |
Missing or inconclusive evidence creates no problem.
Duplicate problems
The same stop recorded twice in one dataset:
| Priority | Side | Condition |
|---|---|---|
| P3 | OSM | Two or more platform or stop_position elements with the same UIC number and local_ref (ignoring case), not counting members of a pair or two-sided stop |
| P2 | Source | The stop belongs to a duplicate group |
A duplicate is a fact about one stop, not about a match, so each stop is reported once, however many matches it has. An unmatched stop carries the problem itself. A matched stop is reported on one of its matches:
- The closest match that a rule made. A propagated match (
source_duplicate_propagation,osm_pair_propagation) only follows another match and reports no duplicate. A source stop matched to a platform and its stop position is therefore reported on the match the rule made, not on the partner's. A group member whose only match is propagated is not reported, but another member of its group can be. - The OSM duplicate first. A match whose OSM element is a duplicate reports that element at most, never its source stop. The source stop is reported on its closest match with an element that is not a duplicate, when it has one.
Disused problems
An OSM element whose stop tag carries a lifecycle prefix, such as disused:highway=bus_stop, never takes part in matching (E1.3). The rule is evaluated only for these elements, and reports one only when the element still needs attention:
| Priority | Condition, first that applies |
|---|---|
| P1 | An unmatched source stop has a compatible station reference: the source still lists the station, and that stop has no OSM partner |
| P2 | An unprefixed stop tag remains, such as public_transport=platform beside disused:highway=bus_stop, or a route relation still lists the element |
| none | Otherwise: the element is cleanly retired |
Compatibility is the profile's station_references_compatible(), so P1 needs a profile that allows station references, such as the Swiss one. Each of the conflicting source stops also has its own unmatched problem. The result bundle format lists the problem's keys and evidence.
Identifier problems
An OSM element can name its exact source stop with an identifier tag, in Switzerland ref:sloid or railway:ref:sloid (E2.1). Identifier matching uses a value only when it names a source stop within the profile's long_distance. This rule reports every element whose tags hold a value that matching could not use:
| Priority | Condition, first that applies | Usual cause |
|---|---|---|
| P1 | A value names a source stop more than long_distance (150 m) away |
Tags copied from another stop |
| P2 | A value is well formed but names no source stop, and none extends it: ch:1:sloid:7000 is known while a platform ch:1:sloid:7000:4:7 exists |
An outdated or mistyped identifier |
| P3 | A value does not have the rule's form, such as a UIC number in ref:sloid |
A different identifier in the wrong tag |
| none | Every value names a stop within reach, or a station or area that has stops |
Matching ignores such a value, so the element is left to the other rules, and a P1 element can be matched to the stop it really is. The rule checks every active element, matched or not, including the ways kept only for their identifier; disused elements get none. There is one problem per element; the result bundle format lists its keys and evidence.
Code
| File | Role |
|---|---|
src/osm_public_transport_matcher/core/problem_detection/pipeline.py |
The rules for matches and unmatched entities |
src/osm_public_transport_matcher/core/problem_detection/stop_predicates/ |
One module per rule |
src/osm_public_transport_matcher/core/problem_detection/context.py |
The shared indexes |
src/osm_public_transport_matcher/api.py |
Calls the disused and identifier rules on their own |
src/osm_public_transport_matcher/core/identifiers.py |
IdentifierIndex, which reads identifier values |
Related pages
- E4 Problems: how the rules are run
- Result bundle format: the keys and evidence of each problem
- E1.3 OSM data: which OSM elements count as disused
- A2.4 Problems page: how reviewers browse the problems