> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_DWithinCC (Python)

> Assign a connected component id to each geometry based on the ST_DWithin predicate.

Assign a connected component id to each geometry based on the ST\_DWithin predicate.

Two geometries are in the same component if they are connected through any chain
of geometries that are within the given distance of each other.

SQL reference: [`ST_DWithinCC`](/reference/wherobots-db/geometry-data/predicates/ST_DWithinCC)

## Signature

```python theme={"system"}
from sedona.spark.sql.st_functions import ST_DWithinCC

ST_DWithinCC(
    geometry: ColumnOrName,
    distance: Union[ColumnOrName, float],
    use_spheroid: Optional[Union[ColumnOrName, bool]] = None,
    partition_by: Optional[ColumnOrName] = None,
) -> Column
```

## Parameters

<ParamField path="geometry" type="ColumnOrName" required>
  Geometry column or name.
</ParamField>

<ParamField path="distance" type="Union[ColumnOrName, float]" required>
  The distance threshold.
</ParamField>

<ParamField path="use_spheroid" type="Optional[Union[ColumnOrName, bool]]" default="None">
  Whether to use spheroid for distance calculation.
</ParamField>

<ParamField path="partition_by" type="Optional[ColumnOrName]" default="None">
  Optional column to partition by before computing components.
</ParamField>

## Returns

<ResponseField name="return" type="Column">
  A long indicating the connected component id.
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.