Predicate Functions
These eight functions assign a connected component ID to each geometry according to a spatial predicate.ST_IntersectsCC
Connects geometries that share at least one point. See the ST_IntersectsCC SQL reference.ST_TouchesCC
Connects geometries that share a boundary point without overlapping interiors. See the ST_TouchesCC SQL reference.ST_OverlapsCC
Connects geometries of the same dimension that share some, but not all, interior points. See the ST_OverlapsCC SQL reference.ST_ContainsCC
Connects geometries when one fully contains another. See the ST_ContainsCC SQL reference.ST_CoversCC
Connects geometries when one covers every point of another. See the ST_CoversCC SQL reference.ST_WithinCC
Connects geometries when one is completely within another. See the ST_WithinCC SQL reference.ST_CoveredByCC
Connects geometries when one is covered by another. See the ST_CoveredByCC SQL reference.ST_CrossesCC
Connects geometries that cross and have a lower-dimensional intersection. See the ST_CrossesCC SQL reference.Shared Predicate Function API
All eight predicate functions share this signature; replaceST_IntersectsCC with the function name you need:
Parameters
ColumnOrName
required
Geometry column or column name to analyze. Pass the desired
GeometryType column explicitly.Optional[ColumnOrName]
Optional column to partition by before computing connected components. When provided, the spatial predicate is only evaluated between rows that share the same partition value. This can significantly improve performance on large datasets.
Returns
BIGINT
A PySpark Column containing the connected component ID for each row, including singletons (geometries that do not satisfy the predicate with any other geometry).
Usage Examples
ST_DWithinCC
Assign a connected component ID to each geometry using a distance-based predicate. See the ST_DWithinCC SQL reference.Parameters
ColumnOrName
required
Geometry column or column name to analyze.
Union[ColumnOrName, float]
required
The distance threshold. Two geometries within this distance are considered connected.
Optional[Union[ColumnOrName, bool]]
Whether to use spheroidal distance calculation. Default is false.
Optional[ColumnOrName]
Optional column to partition by before computing connected components. When provided, the spatial predicate is only evaluated between rows that share the same partition value.
Returns
BIGINT
A PySpark Column containing the connected component ID for each row.

