Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 78 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ geos = { git="https://github.com/georust/geos.git", rev="47afbad2483e489911ddb45

geo-types = "0.7.17"
geo-traits = "0.3.0"
geo = "0.31.0"
geo = "0.32.0"
geojson = "0.24.2"

geo-index = { version = "0.3.2", features = ["use-geo_0_31"] }
Expand Down
2 changes: 1 addition & 1 deletion rust/sedona-geo-generic-alg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ log = "0.4.11"
num-traits = { workspace = true }
robust = "1.1.0"
rstar = "0.12.0"
i_overlay = { version = "4.0.0, < 4.1.0", default-features = false }
i_overlay = { version = "4.0.7", default-features = false }

[dev-dependencies]
sedona-testing = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1571,28 +1571,28 @@ mod tests {
}
}

#[test]
fn test_random_linestring_to_linestring_distance() {
// Test linestring-to-linestring distance with random inputs
for i in 0..100 {
let seed1 = 77777 + i * 59;
let seed2 = 88888 + i * 61;

let ls1 = generate_random_linestring(seed1, 3 + (i % 3) as usize); // 3-5 points
let ls2 = generate_random_linestring(seed2, 3 + ((i + 1) % 3) as usize); // 3-5 points

let concrete_dist = Euclidean.distance(&ls1, &ls2);
// Use our actual generic implementation via nearest_neighbour_distance
let generic_dist = nearest_neighbour_distance(&ls1, &ls2);

assert_relative_eq!(
concrete_dist,
generic_dist,
epsilon = 1e-10,
max_relative = 1e-10
);
}
}
// #[test]
// fn test_random_linestring_to_linestring_distance() {
// // Test linestring-to-linestring distance with random inputs
// for i in 0..100 {
// let seed1 = 77777 + i * 59;
// let seed2 = 88888 + i * 61;

// let ls1 = generate_random_linestring(seed1, 3 + (i % 3) as usize); // 3-5 points
// let ls2 = generate_random_linestring(seed2, 3 + ((i + 1) % 3) as usize); // 3-5 points

// let concrete_dist = Euclidean.distance(&ls1, &ls2);
// // Use our actual generic implementation via nearest_neighbour_distance
// let generic_dist = nearest_neighbour_distance(&ls1, &ls2);

// assert_relative_eq!(
// concrete_dist,
// generic_dist,
// epsilon = 1e-10,
// max_relative = 1e-10
// );
// }
// }
Comment on lines +1574 to +1595
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kontinuation Can you look into these two tests? I am wondering if the mismatch is a bug on our side or a bug on their side (or unrelated and I'm not understanding the test).

The failure is:

thread 'algorithm::line_measures::metric_spaces::euclidean::utils::tests::test_random_linestring_to_linestring_distance' panicked at rust/sedona-geo-generic-alg/src/algorithm/line_measures/metric_spaces/euclidean/utils.rs:1588:13:
assert_relative_eq!(concrete_dist, generic_dist, epsilon = 1e-10, max_relative = 1e-10)

    left  = 28.34636916784935
    right = 21.713575661323034

(i.e., the algorithm here is giving smaller distances than whatever is producing concrete_dist)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary investigations indicate that our calculations are correct, and geo 0.32.0 is incorrect.

I'll look into it further and see if I can submit a patch to georust/geo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have submitted georust/geo#1499 to fix this.


#[test]
fn test_random_polygon_to_polygon_distance() {
Expand Down Expand Up @@ -1638,27 +1638,27 @@ mod tests {
}
}

#[test]
fn test_random_linestring_to_polygon_distance() {
// Test linestring-to-polygon distance with random inputs
for i in 0..100 {
let seed1 = 14141 + i * 83;
let seed2 = 15151 + i * 89;
// #[test]
// fn test_random_linestring_to_polygon_distance() {
// // Test linestring-to-polygon distance with random inputs
// for i in 0..100 {
// let seed1 = 14141 + i * 83;
// let seed2 = 15151 + i * 89;

let linestring = generate_random_linestring(seed1, 3 + (i % 3) as usize); // 3-5 points
let polygon = generate_random_polygon(seed2, 4 + (i % 3) as usize); // 4-6 sides
// let linestring = generate_random_linestring(seed1, 3 + (i % 3) as usize); // 3-5 points
// let polygon = generate_random_polygon(seed2, 4 + (i % 3) as usize); // 4-6 sides

let concrete_dist = Euclidean.distance(&linestring, &polygon);
let generic_dist = distance_linestring_to_polygon_generic(&linestring, &polygon);
// let concrete_dist = Euclidean.distance(&linestring, &polygon);
// let generic_dist = distance_linestring_to_polygon_generic(&linestring, &polygon);

assert_relative_eq!(
concrete_dist,
generic_dist,
epsilon = 1e-8,
max_relative = 1e-8
);
}
}
// assert_relative_eq!(
// concrete_dist,
// generic_dist,
// epsilon = 1e-8,
// max_relative = 1e-8
// );
// }
// }

#[test]
fn test_random_symmetry_properties() {
Expand Down
Loading