summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-05-17 13:26:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-05-17 13:26:57 +0200
commitb86a7560a0911617218f580d84ae8be82d4d9f72 (patch)
tree4032b25fdc2b7df30e511e8516e2597c4b0856e9
parentb588f77ee80752429ff9ea228a4eb15614f5cac9 (diff)
db-iris: basic geolocation support
-rwxr-xr-xbin/db-iris16
1 files changed, 16 insertions, 0 deletions
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{ ^ (?<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 ) {