> ## 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.

# GeoDataFrame.make_valid

> Repairs invalid geometries.

Repairs invalid geometries.

Returns a `GeoSeries` with valid geometries.

If the input geometry is already valid, then it will be preserved.
In many cases, in order to create a valid geometry, the input
geometry must be split into multiple parts or multiple geometries.
If the geometry must be split into multiple parts of the same type
to be made valid, then a multi-part geometry will be returned
(e.g. a MultiPolygon).
If the geometry must be split into multiple parts of different types
to be made valid, then a GeometryCollection will be returned.

In Sedona, only the 'structure' method is available:

* the 'structure' algorithm tries to reason from the structure of the
  input to find the 'correct' repair: exterior rings bound area,
  interior holes exclude area. It first makes all rings valid, then
  shells are merged and holes are subtracted from the shells to
  generate valid result. It assumes that holes and shells are correctly
  categorized in the input geometry.

## Signature

```python theme={"system"}
make_valid(*, method='linework', keep_collapsed=True)
```

## Parameters

<ParamField path="method" type="(linework, structure)" default="'linework'">
  Algorithm to use when repairing geometry. Sedona Geopandas only supports the 'structure' method.
  The default method is "linework" to match compatibility with Geopandas, but it must be explicitly set to
  'structure' to use the Sedona implementation.
</ParamField>

<ParamField path="keep_collapsed" type="bool" default="True">
  For the 'structure' method, True will keep components that have
  collapsed into a lower dimensionality. For example, a ring
  collapsing to a line, or a line collapsing to a point.
</ParamField>

## Examples

```python theme={"system"}
>>> from sedona.spark.geopandas import GeoSeries
>>> from shapely.geometry import MultiPolygon, Polygon, LineString, Point
>>> s = GeoSeries(
...     [
...         Polygon([(0, 0), (0, 2), (1, 1), (2, 2), (2, 0), (1, 1), (0, 0)]),
...         Polygon([(0, 2), (0, 1), (2, 0), (0, 0), (0, 2)]),
...         LineString([(0, 0), (1, 1), (1, 0)]),
...     ],
... )
>>> s
0    POLYGON ((0 0, 0 2, 1 1, 2 2, 2 0, 1 1, 0 0))
1              POLYGON ((0 2, 0 1, 2 0, 0 0, 0 2))
2                       LINESTRING (0 0, 1 1, 1 0)
dtype: geometry
```

```python theme={"system"}
>>> s.make_valid()
0    MULTIPOLYGON (((1 1, 0 0, 0 2, 1 1)), ((2 0, 1...
1                       POLYGON ((0 1, 2 0, 0 0, 0 1))
2                           LINESTRING (0 0, 1 1, 1 0)
dtype: geometry
```


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