diff --git a/milli/Cargo.toml b/milli/Cargo.toml index be507332e..171a7ec4c 100644 --- a/milli/Cargo.toml +++ b/milli/Cargo.toml @@ -16,7 +16,7 @@ flate2 = "1.0.20" fst = "0.4.5" fxhash = "0.2.1" grenad = { version = "0.3.1", default-features = false, features = ["tempfile"] } -haversine = "0.2.1" +geoutils = "0.4.1" heed = { git = "https://github.com/Kerollmops/heed", tag = "v0.12.1", default-features = false, features = ["lmdb", "sync-read-txn"] } human_format = "1.0.3" levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] } diff --git a/milli/src/lib.rs b/milli/src/lib.rs index fc27b9d72..7c9f56665 100644 --- a/milli/src/lib.rs +++ b/milli/src/lib.rs @@ -145,10 +145,10 @@ where /// Return the distance between two points in meters. Each points are composed of two f64, /// one latitude and one longitude. pub 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] }; + let a = geoutils::Location::new(a[0], a[1]); + let b = geoutils::Location::new(b[0], b[1]); - haversine::distance(a, b, haversine::Units::Kilometers) * 1000. + a.haversine_distance_to(&b).meters() } #[cfg(test)]