Travel::Status::DE::IRIS::Stations - Station name to station code mapping


    use Travel::Status::DE::IRIS::Stations;

    my $name = 'Essen Hbf';
    my @stations = Travel::Status::DE::IRIS::Stations::get_station_by_name(

    if (@stations < 1) {
      # no matching stations
    elsif (@stations > 1) {
      # too many matches
    else {
      printf("Input '%s' matched station code %s (as '%s')\n",
        $name, @{$stations[0]});


version 1.09


This module contains a list of Deutsche Bahn stations, and also some stations outside of Germany which are served by Deutsche Bahn trains. It offers several accessors to look up stations based on names or geolocation data and can also simply dump all known stations.

Each of the following methods returns a list of array references. Each array reference describes a single station and contains either two or five elements:

* The station code (also known as DS100 / "Druckschrift 100" / "Richtlinie 100"). A short string used exclusively by Deutsche Bahn APIs. Note that it may contain space characters.
* The station name
* The international station number (IBNR, "Internationale Bahnhofsnummer")
* The station's longitude
* The station's latitude



Returns a list of all known stations, lexically sorted by station name.


Returns a list of stations matching $in.

If a $in is a valid station (either DS100 code or UIC/EVA number), a single array reference describing the station is returned. Otherwise, $in is passed to get_station_by_name($in) (see below).

Note that DS100 code matching is case sensitive.

Travel::Status::DE::IRIS::Stations::get_station_by_location($lon, $lat, $num_matches)

Looks for stations which are close to longitude/latitude $lon/$lat and returns the closest $num_matches (defaults to 10) matches. Note that stations which are located more than 70 kilometers away from $lon/$lat may be ignored when computing the closest matches.

Note that location-based lookup is only supported for stations inside Germany, since the station list data source does not provide geolocation data for non-german stations.


Returns a list of stations where the station name matches $name.

Matching happens in two steps: If a case-insensitive exact match exists, only this one is returned. Otherwise, all stations whose name contains $name as a substring (also case-insensitive) and all stations whose name has a low Levenshtein distance to $name are returned.

This two-step behaviour makes sure that not-prefix-free stations can still be matched directly. For instance, both "Essen-Steele" and "Essen-Steele Ost" are valid station names, but "essen-steele" will only return "Essen-Steele".




* Geo::Distance(3pm)
* List::MoreUtils(3pm)
* List::Util(3pm)
* Text::LevenshteinXS(3pm)


There is no support for intelligent whitespaces (to also match "-" and similar) yet.




Station data: Copyright (C) 2016 by DB Station&Service AG, Europaplatz 1, 10557 Berlin, Germany

Lookup code: Copyright (C) 2014-2019 by Daniel Friesel <>


This module is licensed under the same terms as Perl itself. Note that the station data used by this module is also available under a CC-BY 4.0 license on