shapely.covers

Contents

shapely.covers#

covers(a, b, **kwargs)#

Returns True if no point in geometry B is outside geometry A.

Parameters:
a, bGeometry or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

See also

covered_by

covers(A, B) == covered_by(B, A)

prepare

improve performance by preparing a (the first argument)

Examples

>>> from shapely import LineString, Point, Polygon
>>> line = LineString([(0, 0), (1, 1)])
>>> covers(line, Point(0, 0))
True
>>> covers(line, Point(0.5, 0.5))
True
>>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])
>>> covers(area, Point(0, 0))
True
>>> covers(area, line)
True
>>> covers(area, LineString([(0, 0), (2, 2)]))
False
>>> polygon_with_hole = Polygon(
...     [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)],
...     holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]]
... )
>>> covers(polygon_with_hole, Point(1, 1))
True
>>> covers(polygon_with_hole, Point(2, 2))
True
>>> covers(polygon_with_hole, LineString([(1, 1), (5, 5)]))
False
>>> covers(area, area)
True
>>> covers(area, None)
False