Spatial neighbourhoods in the British National Grid index system
bng_kring.Rd
Identify neighbours in a hollow ring or solid disc at grid distance 'k' from a target BNG reference.
Arguments
- bng_ref
an object of type
BNGReference
- k
numeric value measuring the number of grid squares traversed between the ring and input BNG reference
- ...
additional parameters. Not currently used
Value
list containing an unordered collection of objects of type
BNGReference
within the neighbourhood around the given grid
reference.
Details
K-rings are hollow rings of grid squares at a grid distance k
while k-discs are filled areas around a given grid square up to a grid
distance k. bng_kdisc
includes the given BNG Reference (i.e. the
central grid square).
In the event that bng_ref
is along the edge or corner of the valid
BNG area, then any return BNG references of the ring/disc outside the valid
BNG range will not be returned.
Examples
bng_kring(as_bng_reference("SU1234"), 1)
#> [[1]]
#> <BNGReference[8] with Resolution=1km>
#> [1] <SU 11 33> <SU 12 33> <SU 13 33> <SU 11 34> <SU 13 34> <SU 11 35> <SU 12 35>
#> [8] <SU 13 35>
#>
bng_kring(as_bng_reference("SU1234"), 3)
#> [[1]]
#> <BNGReference[24] with Resolution=1km>
#> [1] <SU 09 31> <SU 10 31> <SU 11 31> <SU 12 31> <SU 13 31> <SU 14 31>
#> [7] <SU 15 31> <SU 09 32> <SU 15 32> <SU 09 33> <SU 15 33> <SU 09 34>
#> [13] <SU 15 34> <SU 09 35> <SU 15 35> <SU 09 36> <SU 15 36> <SU 09 37>
#> [19] <SU 10 37> <SU 11 37> <SU 12 37> <SU 13 37> <SU 14 37> <SU 15 37>
#>
bng_kdisc(as_bng_reference("SU1234"), 1)
#> [[1]]
#> <BNGReference[9] with Resolution=1km>
#> [1] <SU 11 33> <SU 12 33> <SU 13 33> <SU 11 34> <SU 12 34> <SU 13 34> <SU 11 35>
#> [8] <SU 12 35> <SU 13 35>
#>
bng_kdisc(as_bng_reference("SU1234"), 3)
#> [[1]]
#> <BNGReference[49] with Resolution=1km>
#> [1] <SU 09 31> <SU 10 31> <SU 11 31> <SU 12 31> <SU 13 31> <SU 14 31>
#> [7] <SU 15 31> <SU 09 32> <SU 10 32> <SU 11 32> <SU 12 32> <SU 13 32>
#> [13] <SU 14 32> <SU 15 32> <SU 09 33> <SU 10 33> <SU 11 33> <SU 12 33>
#> [19] <SU 13 33> <SU 14 33> <SU 15 33> <SU 09 34> <SU 10 34> <SU 11 34>
#> [25] <SU 12 34> <SU 13 34> <SU 14 34> <SU 15 34> <SU 09 35> <SU 10 35>
#> [31] <SU 11 35> <SU 12 35> <SU 13 35> <SU 14 35> <SU 15 35> <SU 09 36>
#> [37] <SU 10 36> <SU 11 36> <SU 12 36> <SU 13 36> <SU 14 36> <SU 15 36>
#> [43] <SU 09 37> <SU 10 37> <SU 11 37> <SU 12 37> <SU 13 37> <SU 14 37>
#> [49] <SU 15 37>
#>