> ## 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_WithinCC (Python)

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

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

Two geometries are in the same component if they are connected through any chain
of geometries where one is within another.

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

## Signature

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

ST_WithinCC(
    geometry: ColumnOrName,
    partition_by: Optional[ColumnOrName] = None,
) -> Column
```

## Parameters

<ParamField path="geometry" type="ColumnOrName" required>
  Geometry column or name.
</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.