shapely.is_valid#

is_valid(geometry, **kwargs)#

Returns True if a geometry is well formed.

Parameters
geometryGeometry or array_like

Any geometry type is accepted. Returns False for missing values.

**kwargs

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

See also

is_valid_reason

Returns the reason in case of invalid.

Examples

>>> from shapely import GeometryCollection, LineString, Polygon
>>> is_valid(LineString([(0, 0), (1, 1)]))
True
>>> is_valid(Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)]))
False
>>> is_valid(GeometryCollection())
True
>>> is_valid(None)
False