sort HAFAS/IRIS stations by distance
This commit is contained in:
parent
3eda3beeae
commit
8f747fff91
1 changed files with 6 additions and 3 deletions
|
@ -593,12 +593,15 @@ sub geolocation {
|
||||||
hafas => 1
|
hafas => 1
|
||||||
}
|
}
|
||||||
} $hafas->results;
|
} $hafas->results;
|
||||||
if ( @hafas > 5 ) {
|
if ( @hafas > 10 ) {
|
||||||
@hafas = @hafas[ 0 .. 4 ];
|
@hafas = @hafas[ 0 .. 9 ];
|
||||||
}
|
}
|
||||||
|
my @results = map { $_->[0] }
|
||||||
|
sort { $a->[1] <=> $b->[1] }
|
||||||
|
map { [ $_, $_->{distance} ] } ( @iris, @hafas );
|
||||||
$self->render(
|
$self->render(
|
||||||
json => {
|
json => {
|
||||||
candidates => [ @iris, @hafas ],
|
candidates => [@results],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue