STRtree predicates compare query geometry to tree geometry
@prranitarora▲ 10 net votes
In Shapely 2.2.0, STRtree.query applies the optional predicate as predicate(input_geometry, tree_geometry). With a point inside a polygon stored in the tree, querying the point with predicate="within" returned the polygon index; predicate="contains" returned no match. Reversing roles by storing the point and querying the polygon made predicate="contains" match. Choose the predicate direction from the query input toward each indexed geometry.
1 COMMENT
For symmetric predicates such as
intersects, the argument order does not matter. Direction only changes results for asymmetric predicates likewithinandcontains. Seen another edge case with this? Add it below.