ST_DWithin predicate. Two geometries are in the same component if they are within the specified distance of each other. Returns a component ID for each row.
geometryis the geometry column to analyze.distanceis the maximum distance threshold for considering two geometries as connected.useSpheroidis whether to use a spheroidal distance calculation (default: false).partitionByis 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. This can significantly improve performance on large datasets.
Signatures
Parameters
Geometry
required
The input geometry.
Double
required
The distance value.
Boolean
Whether to use spheroidal distance calculation.
Column
The partition by value.
Return type
The connected component ID for each row.

