diff options
| author | Daniel Friesel <daniel.friesel@uos.de> | 2020-02-25 21:25:53 +0100 | 
|---|---|---|
| committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-02-25 21:25:53 +0100 | 
| commit | 3c897ad62aa556b75216ad042631dbe3ff7ed06a (patch) | |
| tree | f27351980a765225b2e27bdebcae399afc9170d8 | |
| parent | 1d2b37f8496fbb9aa03afec50ac9dc496567a908 (diff) | |
polyline sanity check: Handle border stations and incomplete IRIS routes1.15.3
| -rwxr-xr-x | lib/Travelynx.pm | 17 | 
1 files changed, 13 insertions, 4 deletions
| diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 7795ed4..3e8c101 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -2077,10 +2077,19 @@ sub startup {  					$cache->freeze( $url, $ret ); -					my $iris_stations  = join( '|', $train->route ); -					my $hafas_stations = join( '|', @station_list ); - -					if ( $iris_stations ne $hafas_stations ) { +                   # borders ("(Gr)" as in "Grenze") are only returned by HAFAS. +                   # They are not stations. +					my $iris_stations = join( '|', $train->route ); +					my $hafas_stations +					  = join( '|', grep { $_ !~ m{\(Gr\)$} } @station_list ); + +                 # Do not return polyline if it belongs to an entirely different +                 # train. Trains with longer routes (e.g. due to train number +                 # changes, which are handled by HAFAS but left out in IRIS) +                 # are okay though. +					if ( $iris_stations ne $hafas_stations +						and index( $hafas_stations, $iris_stations ) == -1 ) +					{  						$self->app->log->warn( 'Ignoring polyline for '  							  . $train->line  							  . ": IRIS route does not agree with HAFAS route: $iris_stations != $hafas_stations" | 
