use meters in the filters

This commit is contained in:
Tamo 2021-09-07 12:11:03 +02:00
parent 4f69b190bc
commit e5ef0cad9a
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
3 changed files with 17 additions and 5 deletions

View file

@ -142,6 +142,14 @@ where
Some((head, tail))
}
/// Return the distance between two points in meters
fn distance_between_two_points(a: &[f64; 2], b: &[f64; 2]) -> f64 {
let a = haversine::Location { latitude: a[0], longitude: a[1] };
let b = haversine::Location { latitude: b[0], longitude: b[1] };
haversine::distance(a, b, haversine::Units::Kilometers) * 1000.
}
#[cfg(test)]
mod tests {
use serde_json::json;