From b86a7560a0911617218f580d84ae8be82d4d9f72 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 17 May 2016 13:26:57 +0200 Subject: db-iris: basic geolocation support --- bin/db-iris | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'bin') diff --git a/bin/db-iris b/bin/db-iris index 65f617b..b916579 100755 --- a/bin/db-iris +++ b/bin/db-iris @@ -148,6 +148,22 @@ sub get_station { return $input_name; } + if ( $input_name + =~ m{ ^ (? [[:digit:].]+ ) , (? [[: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 ) { -- cgit v1.2.3