Open
Description
With SpatialTreeInterface, this only needs rect-rect distance to work:
import GeometryOps.SpatialTreeInterface as STI
function foreach_within_distance(f, query_geom_or_rect, tree, geoms, distance) # only planar for now
STI.do_query((e1) -> rect_rect_distance(e1, GI.extent(query_geom_or_rect)) <= distance, GI.extent(query_geom_or_rect)) do i
if GO.distance(query_geom_or_rect, geoms[i]) <= distance
f(geoms[i])
end
end
end
function rect_rect_distance(rect1::Extent, rect2::Extent)
# do something here efficiently
end
But we need a nice structure to keep geometries together with a tree...maybe IndexedGeometry or GeoAcceleratedArray?
We may also need to build a spatial index if one doesn't exist.
Unfortunately, finding the nearest geometry is not so trivial, likely needing an expanding search and some form of stack rejection. We might need a priority queue for that.