shapely.is_closed

Contents

shapely.is_closed#

is_closed(geometry, **kwargs)#

Returns True if a linestring’s first and last points are equal.

Parameters:
geometryGeometry or array_like

This function will return False for non-linestrings.

**kwargs

See NumPy ufunc docs for other keyword arguments.

See also

is_ring

Checks additionally if the geometry is simple.

Examples

>>> from shapely import LineString, Point
>>> is_closed(LineString([(0, 0), (1, 1)]))
False
>>> is_closed(LineString([(0, 0), (0, 1), (1, 1), (0, 0)]))
True
>>> is_closed(Point(0, 0))
False