shapely.dwithin#
- dwithin(a, b, distance, **kwargs)#
Return True if the geometries are within a given distance.
Using this function is more efficient than computing the distance and comparing the result.
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.
- distancefloat
Negative distances always return False.
- **kwargs
See NumPy ufunc docs for other keyword arguments.
See also
Examples
>>> import shapely >>> from shapely import Point >>> point = Point(0.5, 0.5) >>> shapely.dwithin(point, Point(2, 0.5), 2) True >>> shapely.dwithin(point, Point(2, 0.5), [2, 1.5, 1]).tolist() [True, True, False] >>> shapely.dwithin(point, Point(0.5, 0.5), 0) True >>> shapely.dwithin(point, None, 100) False