shapely.make_valid#

make_valid(geometry, **kwargs)#

Repairs invalid geometries.

Note

‘make_valid’ requires at least GEOS 3.8.0.

Parameters
geometryGeometry or array_like
**kwargs

For other keyword-only arguments, see the NumPy ufunc docs.

Examples

>>> from shapely import is_valid, Polygon
>>> polygon = Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)])
>>> is_valid(polygon)
False
>>> make_valid(polygon)
<MULTILINESTRING ((0 0, 1 1), (1 1, 1 2))>