shapely.concave_hull

Contents

shapely.concave_hull#

concave_hull(geometry, ratio=0.0, allow_holes=False, **kwargs)#

Computes a concave geometry that encloses an input geometry.

Note

‘concave_hull’ requires at least GEOS 3.11.0.

Parameters:
geometryGeometry or array_like
ratiofloat, default 0.0

Number in the range [0, 1]. Higher numbers will include fewer vertices in the hull.

allow_holesbool, default False

If set to True, the concave hull may have holes.

**kwargs

See NumPy ufunc docs for other keyword arguments.

Examples

>>> from shapely import MultiPoint, Polygon
>>> concave_hull(MultiPoint([(0, 0), (0, 3), (1, 1), (3, 0), (3, 3)]), ratio=0.1)
<POLYGON ((0 0, 0 3, 1 1, 3 3, 3 0, 0 0))>
>>> concave_hull(MultiPoint([(0, 0), (0, 3), (1, 1), (3, 0), (3, 3)]), ratio=1.0)
<POLYGON ((0 0, 0 3, 3 3, 3 0, 0 0))>
>>> concave_hull(Polygon())
<POLYGON EMPTY>