GEOS 3.10 is bringing new functions to the CAPI: GEOSDistanceWithin / GEOSPreparedDistanceWithin
In addition to exposing these as predicates similar to pygeos.intersects (but with broadcastable distance value), we likely want to add this to STRtree.
There are a couple ways we could do this:
- extend
STRtree.query_bulk to take allow within_distance as a valid predicate that requres an additional parameter distance. Distance could be broadcast to the same shape as the input geometries (meaning: unique distance value per input geometry). This would first need to extend the envelopes of the input geometries +/- distance (plus a tiny epsilon value) before querying the tree (like we do in nearest_all), then apply GEOSPreparedDistanceWithin predicate after that.
- add a dedicated
STRtree.within_distance function that behaves much like query_bulk that only does the same operations as above. My instinct is that this is the cleanest approach.
GEOS 3.10 is bringing new functions to the CAPI: GEOSDistanceWithin / GEOSPreparedDistanceWithin
In addition to exposing these as predicates similar to
pygeos.intersects(but with broadcastable distance value), we likely want to add this to STRtree.There are a couple ways we could do this:
STRtree.query_bulkto take allowwithin_distanceas a valid predicate that requres an additional parameterdistance. Distance could be broadcast to the same shape as the input geometries (meaning: unique distance value per input geometry). This would first need to extend the envelopes of the input geometries +/-distance(plus a tiny epsilon value) before querying the tree (like we do innearest_all), then applyGEOSPreparedDistanceWithinpredicate after that.STRtree.within_distancefunction that behaves much likequery_bulkthat only does the same operations as above. My instinct is that this is the cleanest approach.