()
| 220 | |
| 221 | #[test] |
| 222 | fn join_with_dwithin() { |
| 223 | let left = vec![(1u64, Geometry::point(0.0, 0.0))]; |
| 224 | let right = vec![(100u64, Geometry::point(0.001, 0.0))]; // ~111m away |
| 225 | |
| 226 | let index = build_join_index(&left); |
| 227 | let probes: Vec<(u64, BoundingBox)> = right |
| 228 | .iter() |
| 229 | .map(|(id, g)| { |
| 230 | // Expand bbox by distance for R-tree search. |
| 231 | (*id, geometry_bbox(g).expand_meters(500.0)) |
| 232 | }) |
| 233 | .collect(); |
| 234 | |
| 235 | let left_map: std::collections::HashMap<u64, Geometry> = left.into_iter().collect(); |
| 236 | let right_map: std::collections::HashMap<u64, Geometry> = right.into_iter().collect(); |
| 237 | |
| 238 | let result = spatial_join( |
| 239 | &index, |
| 240 | &probes, |
| 241 | &|id| left_map.get(&id).cloned(), |
| 242 | &|id| right_map.get(&id).cloned(), |
| 243 | SpatialJoinPredicate::DWithin(500.0), // 500m |
| 244 | ); |
| 245 | |
| 246 | assert_eq!(result.pairs.len(), 1); |
| 247 | } |
| 248 | } |
nothing calls this directly
no test coverage detected