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

> Convert an invalid geometry in a geometry column into a valid geometry.

Convert an invalid geometry in a geometry column into a valid geometry.

May reorder coordinates or reverse polygon ring orientation, including for
already-valid inputs. Apply `ST_ForcePolygonCCW` or
`ST_ForcePolygonCW` to the result to enforce a specific ring orientation.
These functions are not guaranteed to restore the original vertex order or
starting vertex.

SQL reference: [`ST_MakeValid`](/reference/wherobots-db/geometry-data/validation/ST_MakeValid)

## Signature

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

ST_MakeValid(
    geometry: ColumnOrName,
    keep_collapsed: Optional[Union[ColumnOrName, bool]] = None,
) -> Column
```

## Parameters

<ParamField path="geometry" type="ColumnOrName" required>
  Geometry column that contains the invalid geometry.
</ParamField>

<ParamField path="keep_collapsed" type="Optional[Union[ColumnOrName, bool]]" default="None">
  If True, preserve collapsed geometries as valid geometries
  of a lower dimension. If False, convert them to empty geometries. If None,
  use the default value of False.
</ParamField>

## Returns

<ResponseField name="return" type="Column">
  Geometry column that contains valid versions of the original geometry.
</ResponseField>


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