shapely.is_ring#

is_ring(geometry, **kwargs)#

Returns True if a linestring is closed and simple.

Parameters
geometryGeometry or array_like

This function will return False for non-linestrings.

**kwargs

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

See also

is_closed

Checks only if the geometry is closed.

is_simple

Checks only if the geometry is simple.

Examples

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