osbng.bng_reference.BNGReference.bng_is_neighbour#
- BNGReference.bng_is_neighbour(bng_ref2: BNGReference) bool[source]#
Tests whether
bng_ref2is a neighbour of thisBNGReference.Neighbours are defined as grid squares that share an edge with this
BNGReferenceobject.- Parameters:
bng_ref2 (BNGReference) – A
BNGReferenceobject.
- Returns:
True if the two
BNGReferenceobjects are neighbours, otherwise False.- Return type:
- Raises:
TypeError – If the
bng_ref2argument is not aBNGNeighbourError – If the
BNGReferenceobjectis not at the same resolution. –
Examples
>>> BNGReference("SE1921").bng_is_neighbour(BNGReference("SE1821")) True >>> BNGReference("SE1922").bng_is_neighbour(BNGReference("SE1821")) False >>> BNGReference("SU1234").bng_is_neighbour(BNGReference("SU1234")) False
See also
The equivalent
osbng.traversal.bng_is_neighbour()function.