Matching engine E.2.2
Name matching
On this page
The name rule (name, one of the matching rules) matches a source stop to an OSM element with exactly the same name. It catches stops that the reference rules could not match, for example because the OSM element has no uic_ref.
How it works
For each unmatched source stop with a non-empty name, the rule looks up the OSM elements whose name, uic_name or gtfs:name tag is exactly that string: case, accents and abbreviations must agree. The rule does not normalize names, so St. and Sankt, or a name with and without a municipality prefix, are different names. Stations and pair partners are excluded, as for every rule.
- One candidate: it is chosen, as
name_one_osm, unless an identifier already linked part of the stop's station: the one element left is then not the stop by elimination, and only the platform code decides, as below (E2.1). - Several candidates: the first whose
local_refequals the stop's platform code, ignoring case, is chosen, asname_local_ref. Without such a candidate, or when the stop has no platform code, the stop stays unmatched. - Distance limit: the chosen candidate must lie within the profile's
name_match_max_distance: 1000 m in the default profile, because the same name can occur in several towns. The Swiss profile sets no limit.
| Dataset | Name field | Record field | Platform code |
|---|---|---|---|
| ATLAS | designationOfficial |
SourceStop.name |
SourceStop.platform_code (designation) |
| OSM | name, uic_name, gtfs:name tags |
OsmNode.name, OsmNode.uic_name, tags['gtfs:name'] |
OsmNode.local_ref |
Stops still unmatched go on to the GTFS route rule and the distance rules.
Name aliases in the Swiss profile
The OSM name index lists an element under each of its name tags. The Swiss profile sets preserve_name_alias_multiplicity, which keeps an element listed once per tag, even when name and uic_name hold the same value. Such an element then counts as two candidates for that name, so the name rule can only choose it through a matching platform code; otherwise a later rule can match it, such as the group rule as uic_name_group_distance. The generic profile lists each distinct name once.
Code
| File | Role |
|---|---|
src/osm_public_transport_matcher/core/predicates/name_matching.py |
NamePredicate |
src/osm_public_transport_matcher/core/state.py |
OsmState.from_records() builds the name index |
Related pages
- E2.1 Reference matching: the rules before it
- E2.3 GTFS route matching and E2.4 Distance matching: the rules after it
- E4.1 Stop problems: matched stops whose names disagree