Skip to content

API: STRtree handling of GEOSDistanceWithin #402

@brendan-ward

Description

@brendan-ward

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:

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions