shapely.minimum_clearance_line

shapely.minimum_clearance_line#

minimum_clearance_line(geometry, **kwargs)#

Return a LineString whose endpoints define the minimum clearance.

A geometry’s “minimum clearance” is the smallest distance by which a vertex of the geometry could be moved to produce an invalid geometry.

If the geometry has no minimum clearance, an empty LineString will be returned.

Added in version 2.1.0.

Parameters:
geometryGeometry or array_like

Geometry or geometries to determine the minimum clearance line for.

**kwargs

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

Examples

>>> import shapely
>>> from shapely import Polygon
>>> poly = Polygon([(0, 0), (10, 0), (10, 10), (5, 5), (0, 10), (0, 0)])
>>> shapely.minimum_clearance_line(poly)
<LINESTRING (5 5, 5 0)>