Return True if the geometries are within a given distance. Using this function is more efficient than computing the distance and comparing the result. Parameters ---------- a, b : Geometry or array_like Geometry or geometries to check. distance : float Negat
(a, b, distance, **kwargs)
| 1209 | @multithreading_enabled |
| 1210 | @requires_geos("3.10.0") |
| 1211 | def dwithin(a, b, distance, **kwargs): |
| 1212 | """Return True if the geometries are within a given distance. |
| 1213 | |
| 1214 | Using this function is more efficient than computing the distance and |
| 1215 | comparing the result. |
| 1216 | |
| 1217 | Parameters |
| 1218 | ---------- |
| 1219 | a, b : Geometry or array_like |
| 1220 | Geometry or geometries to check. |
| 1221 | distance : float |
| 1222 | Negative distances always return False. |
| 1223 | **kwargs |
| 1224 | See :ref:`NumPy ufunc docs <ufuncs.kwargs>` for other keyword arguments. |
| 1225 | |
| 1226 | See Also |
| 1227 | -------- |
| 1228 | distance : compute the actual distance between A and B |
| 1229 | prepare : improve performance by preparing ``a`` (the first argument) |
| 1230 | |
| 1231 | Examples |
| 1232 | -------- |
| 1233 | >>> import shapely |
| 1234 | >>> from shapely import Point |
| 1235 | >>> point = Point(0.5, 0.5) |
| 1236 | >>> shapely.dwithin(point, Point(2, 0.5), 2) |
| 1237 | True |
| 1238 | >>> shapely.dwithin(point, Point(2, 0.5), [2, 1.5, 1]).tolist() |
| 1239 | [True, True, False] |
| 1240 | >>> shapely.dwithin(point, Point(0.5, 0.5), 0) |
| 1241 | True |
| 1242 | >>> shapely.dwithin(point, None, 100) |
| 1243 | False |
| 1244 | |
| 1245 | """ |
| 1246 | return lib.dwithin(a, b, distance, **kwargs) |
| 1247 | |
| 1248 | |
| 1249 | @multithreading_enabled |
nothing calls this directly
no test coverage detected
searching dependent graphs…