osbng.bng_reference.BNGReference.bng_dwithin#

BNGReference.bng_dwithin(d: int | float) list[BNGReference][source]#

Returns all BNGReference objects within distance d of this BNGReference.

All grid squares will be returned for which any part of its boundary is within distance d of any part of the BNGReference object’s boundary.

Parameters:

d (int or float) – The absolute distance d in metres.

Returns:

All grid squares which have any part of their geometry within distance d of the current grid square

Return type:

list[BNGReference]

Examples

>>> BNGReference("SU1234").bng_dwithin(1000)
[
BNGReference(bng_ref_formatted=SU 11 33, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 12 33, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 13 33, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 11 34, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 12 34, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 13 34, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 11 35, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 12 35, resolution_label=1km),
BNGReference(bng_ref_formatted=SU 13 35, resolution_label=1km)
]
>>> BNGReference("SU1234").bng_dwithin(1001)
[list of 21 BNGReference objects]

See also

The equivalent osbng.traversal.bng_dwithin() function.