shapely.covered_by#

covered_by(a, b, **kwargs)#

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

Parameters
a, bGeometry or array_like
**kwargs

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

See also

covers

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

prepare

improve performance by preparing a (the first argument)

Examples

>>> from shapely import LineString, Point, Polygon
>>> line = LineString([(0, 0), (1, 1)])
>>> covered_by(Point(0, 0), line)
True
>>> covered_by(Point(0.5, 0.5), line)
True
>>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])
>>> covered_by(Point(0, 0), area)
True
>>> covered_by(line, area)
True
>>> covered_by(LineString([(0, 0), (2, 2)]), area)
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)]]
... )
>>> covered_by(Point(1, 1), polygon_with_hole)
True
>>> covered_by(Point(2, 2), polygon_with_hole)
True
>>> covered_by(LineString([(1, 1), (5, 5)]), polygon_with_hole)
False
>>> covered_by(area, area)
True
>>> covered_by(None, area)
False