MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / join_no_overlap

Function join_no_overlap

nodedb-spatial/src/spatial_join.rs:179–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177
178 #[test]
179 fn join_no_overlap() {
180 let left = vec![(
181 1u64,
182 Geometry::polygon(vec![vec![
183 [0.0, 0.0],
184 [1.0, 0.0],
185 [1.0, 1.0],
186 [0.0, 1.0],
187 [0.0, 0.0],
188 ]]),
189 )];
190 let right = vec![(
191 100u64,
192 Geometry::polygon(vec![vec![
193 [50.0, 50.0],
194 [51.0, 50.0],
195 [51.0, 51.0],
196 [50.0, 51.0],
197 [50.0, 50.0],
198 ]]),
199 )];
200
201 let index = build_join_index(&left);
202 let probes: Vec<(u64, BoundingBox)> = right
203 .iter()
204 .map(|(id, g)| (*id, geometry_bbox(g)))
205 .collect();
206
207 let left_map: std::collections::HashMap<u64, Geometry> = left.into_iter().collect();
208 let right_map: std::collections::HashMap<u64, Geometry> = right.into_iter().collect();
209
210 let result = spatial_join(
211 &index,
212 &probes,
213 &|id| left_map.get(&id).cloned(),
214 &|id| right_map.get(&id).cloned(),
215 SpatialJoinPredicate::Intersects,
216 );
217
218 assert!(result.pairs.is_empty());
219 }
220
221 #[test]
222 fn join_with_dwithin() {

Callers

nothing calls this directly

Calls 6

build_join_indexFunction · 0.85
geometry_bboxFunction · 0.85
spatial_joinFunction · 0.85
collectMethod · 0.80
iterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected