Skip to main content

Transit queries

A transit query names a station, stop, airport, terminal, or interchange. The user wants to find the transit facility — to depart from it, arrive at it, or navigate near it. Transit queries sit between landmark queries (named stations are landmarks) and amenityamenityA point of interest referenced by category ('gas station', 'pharmacy', 'ATM') rather than by name. Resolved by mapping the query onto a category taxonomy. queries (unnamed bus stops are amenities).

What transit queries look like

QueryType
Grand Central TerminalNamed station — unique, well-known
Shibuya StationNamed station — major hub, multiple exits
Heathrow AirportNamed airport — large area, multiple terminals
bus stop #4521Numbered stop — not a name, a route identifier
Metro Center (DC Metro)Named station — multiple cities have a "Metro Center"
Tokyo StationNamed station — massive complex, underground citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy.
Port Authority Bus TerminalNamed terminal — multiple carriers, multiple levels
ferry terminalGeneric — which one?
JFKAirport codeIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries. — three letters, globally unique
LHR T5Airport codeIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries. + terminal — specific part of a larger facility
the train stationImplicit — "the" train station where the user is

Transit queries have more structural variety than amenityamenityA point of interest referenced by category ('gas station', 'pharmacy', 'ATM') rather than by name. Resolved by mapping the query onto a category taxonomy. queries. They can be named (Grand Central), coded (JFK), numbered (bus stop #4521), or implicit ("the train station"). The geocoder must handle all of these forms.

Station-as-multi-point problem

A major transit station is more than a point — it's a complex with multiple entrances, exits, platforms, and often an entire underground or above-ground citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy.:

  • Shibuya Station (Tokyo) has 6 exits, multiple train and subway lines, a bus terminal, and a surrounding commercial district. The "station" is a neighborhood-scale complex. A single coordinate for "Shibuya Station" is wrong for any specific use — the Hachikō exit is 200 meters from the New South exit, and the wrong exit can mean a 10-minute walk in the wrong direction.
  • Tokyo Station has an underground citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. with shopping, dining, and office space. The Marunouchi exit faces the Imperial Palace; the Yaesu exit faces the business district.
  • Heathrow Airport has 5 terminals connected by train. A query for "Heathrow" could mean any terminal. A query for "Heathrow T5" is specific. The geocoder should return the airport centroid for the former and Terminal 5's coordinates for the latter.
  • Port Authority Bus Terminal (New York) has multiple levels, multiple carriers, and gates numbered by floor. The "station" is a building; the "gate" is a specific point within it.

Transit stations need a hierarchical modelneural classifierThe machine learning model at the core of Mailwoman's parser — a transformer encoder (~30M parameters) trained from scratch to do BIO token classification over addresses. It learns the 'grammar' of address formats; the gazetteer supplies the 'atlas.': station → entrance/exit → platform/gate. Most geocoders only modelneural classifierThe machine learning model at the core of Mailwoman's parser — a transformer encoder (~30M parameters) trained from scratch to do BIO token classification over addresses. It learns the 'grammar' of address formats; the gazetteer supplies the 'atlas.' the station level. A user searching for "Shibuya Station Hachikō exit" needs entrance-level precisionprecisionOf the spans the model labeled as a given tag, the fraction it got right. High precision means few false positives. Paired with recall to compute F1.. Most geocoders return the station centroid.

Station-name ambiguity problem

Many cities have stations with the same name:

  • "Union Station" exists in Washington DC, Los Angeles, Chicago, Toronto, and dozens of other cities.
  • "Central Station" exists in most major cities worldwide.
  • "Metro Center" is a station name in the DC Metro, but "metro center" is also a generic term for a transit hub.

The station name alone is not unique. The geocoder needs the citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. context to disambiguate — "Union Station, Washington DC" vs "Union Station, Los Angeles." This is the same problem as "Springfield" ambiguity, but for transit infrastructure.

Airport codesIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries. (JFK, LHR, NRT, CDG, DXB) are globally unique three-letter IATA codesIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries.. A query for "JFK" unambiguously means John F. Kennedy International Airport in New York. Airport codesIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries. are the most machine-friendly transit identifiers — short, globally unique, and standardized.

Implicit-station problem

"The train station" without a citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. name implies "the train station where the user is." The geocoder needs the user's location to resolve this. The parser does its job here, correctly identifying "train station" as a transit query; the missing piece is contextual — the resolverresolverThe component that converts parsed address components (locality, region, postcode) into coordinates by looking them up in the gazetteer. The resolver ranks candidates by name match, population, and proximity, and returns the best-matching place with its centroid or polygon. needs a place to search near, and without one the query is unresolvable.

"Subway station near me" is the same pattern: transit category + implicit location. The geocoder needs the user's location to answer it.

How traditional geocoders handle transit queries

Google's Places API handles transit queries well. Stations, airports, and transit hubs are first-class place types. Google's transit data includes station entrancesstation entranceOne of several access points to a large transit station. Entrances at stations like Tokyo or Shibuya can be hundreds of metres apart, so entrance-level precision matters for navigation. and exits (where available from local transit agencies) and airport terminal coordinates. "Shibuya Station" returns a coordinate for the station; Google Maps shows individual exits as separate markers.

Nominatim handles transit through OSMOpenStreetMap (OSM). A community-curated global map database (ODbL-licensed) with addr:* tagged features and place hierarchies. A secondary corpus source and a source of street names.'s transit tagging (railway=station, aeroway=aerodrome, public_transport=station). OSMOpenStreetMap (OSM). A community-curated global map database (ODbL-licensed) with addr:* tagged features and place hierarchies. A secondary corpus source and a source of street names. station data is excellent in well-mapped areas — individual platforms, entrances, and exits are often tagged. Station name ambiguity is handled through the OSMOpenStreetMap (OSM). A community-curated global map database (ODbL-licensed) with addr:* tagged features and place hierarchies. A secondary corpus source and a source of street names. hierarchy: the station's containing citylocalityThe city / town / settlement component of an address: a populated place sitting between region and neighbourhood in the hierarchy. is part of the OSMOpenStreetMap (OSM). A community-curated global map database (ODbL-licensed) with addr:* tagged features and place hierarchies. A secondary corpus source and a source of street names. record.

PeliasPeliasAn open-source geocoder, Mailwoman's spiritual predecessor. indexes transit stations through OSMOpenStreetMap (OSM). A community-curated global map database (ODbL-licensed) with addr:* tagged features and place hierarchies. A secondary corpus source and a source of street names. and WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations.. WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. has transit stations as venue or campus placetypesplacetypeThe Who's On First hierarchical classification of places: planet → continent → country → region → county → locality → neighbourhood. The resolver uses placetype to rank candidates — an exact locality match outranks a county-level match.. The data is as good as the underlying OSMOpenStreetMap (OSM). A community-curated global map database (ODbL-licensed) with addr:* tagged features and place hierarchies. A secondary corpus source and a source of street names. contribution in each area. Station entrancestation entranceOne of several access points to a large transit station. Entrances at stations like Tokyo or Shibuya can be hundreds of metres apart, so entrance-level precision matters for navigation. data is sparse outside of major cities.

What Mailwoman does today

Mailwoman's resolverresolverThe component that converts parsed address components (locality, region, postcode) into coordinates by looking them up in the gazetteer. The resolver ranks candidates by name match, population, and proximity, and returns the best-matching place with its centroid or polygon. indexes WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. administrative places plus a limited set of WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. venuesvenueA named, non-address place — a business, building, park, or stadium. Mailwoman's free-text point-of-interest component, added as a Tier 2 fine label.. Transit stations that exist in WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. are resolvable; stations that don't are not. Airport codesIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries. (JFK, LHR) are not in WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations.'s name index — WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. uses full names ("John F. Kennedy International Airport"), not codes.

The parser handles transit queries as a mixed case: a named station like "Grand Central Terminal" looks like a venuevenueA named, non-address place — a business, building, park, or stadium. Mailwoman's free-text point-of-interest component, added as a Tier 2 fine label. query. An unnamed transit query like "bus stop" looks like an amenityamenityA point of interest referenced by category ('gas station', 'pharmacy', 'ATM') rather than by name. Resolved by mapping the query onto a category taxonomy. query, and the amenityamenityA point of interest referenced by category ('gas station', 'pharmacy', 'ATM') rather than by name. Resolved by mapping the query onto a category taxonomy.-query path — the poi_query kind, the @mailwoman/poi-taxonomy lexicon, poi.db resolution — is working infrastructure now (see Amenity queries). It doesn't cover transit yet: the taxonomy's 23-category seed has no bus_stop, train_station, or airport entries, so an unnamed transit query has nowhere in the lexicon to land.

Transit queries are partially in scope (same as landmarks) but underserved. The venuevenueA named, non-address place — a business, building, park, or stadium. Mailwoman's free-text point-of-interest component, added as a Tier 2 fine label. classifier and WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. venuevenueA named, non-address place — a business, building, park, or stadium. Mailwoman's free-text point-of-interest component, added as a Tier 2 fine label. records cover named stations in well-populated WOFWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. regionsregionThe first-level administrative subdivision of a country — a US state, a French region, a province. The component between country and locality.. Station entrancestation entranceOne of several access points to a large transit station. Entrances at stations like Tokyo or Shibuya can be hundreds of metres apart, so entrance-level precision matters for navigation. data, airport codeIATA code (International Air Transport Association code). A three-letter airport code (JFK, LHR, CDG). Globally unique and machine-friendly, useful for resolving airport queries. resolution, and numbered-stop resolution are not supported, and transit categories haven't been added to the POIpoint of interest (POI). A named place that is not strictly an address — landmark, transit stop, venue, amenity, or franchise. Mailwoman tags these as venue and resolves them through the gazetteer. taxonomy yet.

See also