# shapely.crosses#

crosses(a, b, **kwargs)#

Returns True if A and B spatially cross.

A crosses B if they have some but not all interior points in common, the intersection is one dimension less than the maximum dimension of A or B, and the intersection is not equal to either A or B.

Parameters:
a, bGeometry or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

prepare

improve performance by preparing a (the first argument)

Examples

>>> from shapely import LineString, MultiPoint, Point, Polygon
>>> line = LineString([(0, 0), (1, 1)])
>>> # A contains B:
>>> crosses(line, Point(0.5, 0.5))
False
>>> # A and B intersect at a point but do not share all points:
>>> crosses(line, MultiPoint([(0, 1), (0.5, 0.5)]))
True
>>> crosses(line, LineString([(0, 1), (1, 0)]))
True
>>> # A is contained by B; their intersection is a line (same dimension):
>>> crosses(line, LineString([(0, 0), (2, 2)]))
False
>>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])
>>> # A contains B:
>>> crosses(area, line)
False
>>> # A and B intersect with a line (lower dimension) but do not share all points:
>>> crosses(area, LineString([(0, 0), (2, 2)]))
True
>>> # A contains B:
>>> crosses(area, Point(0.5, 0.5))
False
>>> # A contains some but not all points of B; they intersect at a point:
>>> crosses(area, MultiPoint([(2, 2), (0.5, 0.5)]))
True