shapely.dwithin#
- dwithin(a, b, distance, **kwargs)#
Return 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
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