shapely.dwithin#
- dwithin(a, b, distance, **kwargs)#
Returns True if the geometries are within a given distance.
Note
‘dwithin’ requires at least GEOS 3.10.0.
Using this function is more efficient than computing the distance and comparing the result.
- Parameters:
- a, bGeometry or array_like
- distancefloat
Negative distances always return False.
- **kwargs
For other keyword-only arguments, see the NumPy ufunc docs.
See also
Examples
>>> from shapely import Point >>> point = Point(0.5, 0.5) >>> dwithin(point, Point(2, 0.5), 2) True >>> dwithin(point, Point(2, 0.5), [2, 1.5, 1]).tolist() [True, True, False] >>> dwithin(point, Point(0.5, 0.5), 0) True >>> dwithin(point, None, 100) False