Skip to main content
Computes spatial connected components across the entire dataframe using the ST_Crosses predicate. Two geometries are in the same component if they cross (their intersection produces a geometry of lower dimension than the maximum dimension of the input geometries). Returns a component ID for each row. ST_CrossesCC
  • geometry is the geometry column to analyze.
  • partitionBy is an optional column to partition the data before computing connected components. When provided, the spatial predicate is only evaluated between rows that share the same partition value. WherobotsDB compares every pair of rows that share a value, so the work for each value grows with the square of its row count. To keep a few large groups apart, filter the data to one group at a time and call the function without partitionBy. Component IDs from separate calls can repeat, so keep the group column with the component ID when you combine the results.

Signatures

Parameters

Geometry
required
The input geometry.
Column
The partition by value.

Return type

The connected component ID for each row.

Example