summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-06-06 18:59:31 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-06-06 18:59:31 +0200
commit995035c5796397e49c2819e7e9f1efd7a5c0a4bc (patch)
tree0a0ae4f6d1f9661bb1cdb6cd44bb5f10ff16ac80
parentb27286f572030bc84e19003e66b04a43f5f9b851 (diff)
db-iris: improve geolocation candidate and error handling
-rwxr-xr-xbin/db-iris10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/db-iris b/bin/db-iris
index d5cb388..528663e 100755
--- a/bin/db-iris
+++ b/bin/db-iris
@@ -154,11 +154,19 @@ sub get_station {
my @candidates
= Travel::Status::DE::IRIS::Stations::get_station_by_location(
$+{lon}, $+{lat} );
+
+ if ( not @candidates ) {
+ say STDERR
+ "Found no stations inside a 70km radius around $+{lon},$+{lat}";
+ exit(1);
+ }
+
say STDERR "Geolocation candidates for $+{lon},$+{lat} are:";
say STDERR join(
"\n",
map {
- sprintf( "%s (%s) - %-3.1fkm", $_->[0][1], $_->[0][0], $_->[1] )
+ sprintf( "%-30s %-5s %4.1fkm",
+ $_->[0][1], $_->[0][0], $_->[1] )
} @candidates
);
exit(1);