Skip to main content

Module spatial_join

Module spatial_join 

Source
Expand description

Spatial join strategy: R-tree probe join.

When two collections are joined on a spatial predicate (ST_Intersects(a.geom, b.geom)), the naive approach is nested-loop O(N*M). With an R-tree index on one side, we get O(N * log M):

  1. Build R-tree on the smaller collection (or use existing index)
  2. For each geometry in the larger collection, R-tree range search
  3. For each candidate pair, apply exact predicate

This module provides the join logic; the planner decides which side to index based on collection cardinality.

Structs§

SpatialJoinResult
Result of a spatial join between two collections.

Enums§

SpatialJoinPredicate
Which spatial predicate to use for the join.

Functions§

build_join_index
Build an R-tree from a list of (entry_id, geometry) pairs for join.
spatial_join
Execute a spatial join using R-tree probe.