Commit b86a7560 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

db-iris: basic geolocation support

parent b588f77e
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -148,6 +148,22 @@ sub get_station {
		return $input_name;
	}

	if ( $input_name
		=~ m{ ^ (?<lon> [[:digit:].]+ ) , (?<lat> [[:digit:].]+ ) }x )
	{
		my @candidates
		  = Travel::Status::DE::IRIS::Stations::get_station_by_location(
			$+{lon}, $+{lat} );
		say STDERR "Geolocation candidates for $+{lon},$+{lat} are:";
		say STDERR join(
			"\n",
			map {
				sprintf( "%s (%s) - %-3.1fkm", $_->[0][1], $_->[0][0], $_->[1] )
			} @candidates
		);
		exit(1);
	}

	my @stations = Travel::Status::DE::IRIS::Stations::get_station($input_name);

	if ( @stations == 0 ) {