shapely.minimum_width#
- minimum_width(geometry, **kwargs)#
Compute the minimum width (minimum diameter) of a geometry.
The minimum width is defined as the width of the smallest band that contains the geometry, where a band is a strip of the plane defined by two parallel lines. This is also known as the minimum diameter.
This function always returns a LineString representing the minimum width line segment, including for degenerate cases, such as LineStrings or Points. (In these cases, the minimum width is a zero-length LineString).
- Parameters:
- geometryGeometry or array_like
Geometry or geometries for which to compute the minimum width.
- **kwargs
See NumPy ufunc docs for other keyword arguments.
See also
Examples
>>> import shapely >>> from shapely import Point, LineString, Polygon >>> polygon = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) >>> shapely.minimum_width(polygon) <LINESTRING (0 0, 1 0)> >>> line = LineString([(0, 0), (3, 4)]) >>> shapely.minimum_width(line) <LINESTRING (0 0, 0 0)>