shapely.intersects#
- intersects(a, b, **kwargs)#
Return True if A and B share any portion of space.
Intersects implies that overlaps, touches, covers, or within are True.
If you need to test multiple geometries against the same geometry A, you can improve performance by preparing A in advance using
prepare().- Parameters:
- a, bGeometry or array_like
Geometry or geometries to check.
- **kwargs
See NumPy ufunc docs for other keyword arguments.
See also
disjointintersects(A, B) == ~disjoint(A, B)prepareimprove performance by preparing
a(the first argument)intersects_xyvariant for checking against a Point with x, y coordinates
Examples
>>> import shapely >>> from shapely import LineString, Point >>> line = LineString([(0, 0), (1, 1)]) >>> shapely.intersects(line, Point(0, 0)) True >>> shapely.intersects(line, Point(0, 1)) False >>> shapely.intersects(line, LineString([(0, 2), (2, 0)])) True >>> shapely.intersects(None, None) False