Navigate the British National Grid hierarchy
bng_to_children.Rd
Identify the "parent" or "children" references which contain or are nested within a given BNG reference.
Arguments
- bng_ref
object of type
BNGReference
- resolution
(optional) value of the target resolution of parent/child references. If omitted, the next resolution relative to the input BNG reference is assumed.
- ...
additional parameters. Not currently used
Value
child references will be a list of BNGReference
objects with
each item in the list being the set of children for the input grid
reference. Parent references will be a vector of BNGReference
objects.
Details
The BNG is structured using a hierarchical system of grid squares at various resolutions. At its highest level, the grid divides GB into 100 km by 100 km squares, each identified by a two-letter code. Successive levels of resolution further subdivide the grid squares into finer detail, down to individual 1-meter squares. These functions allow for the traversal of this hierarchy by providing methods to return the parent and children of BNGReference objects at specified resolutions.
Definitions:
- Parent
The parent of a BNGReference object is the grid square at the next higher (coarser) resolution level that contains the current reference. For example, the parent of a 1km grid square reference would be the 5km grid square that contains it.
- Children
The children of a BNGReference object are the grid squares at the next lower (finer) resolution level that are contained within the current reference. For example, the children of a 10km grid square reference would be all the 5km grid squares that it contains.
Examples
bng_to_children(as_bng_reference("SU"))
#> [[1]]
#> <BNGReference[4] with Resolution=50km>
#> [1] <SU SW> <SU SE> <SU NW> <SU NE>
#>
bng_to_children(as_bng_reference("SU36"))
#> [[1]]
#> <BNGReference[4] with Resolution=5km>
#> [1] <SU 3 6 SW> <SU 3 6 SE> <SU 3 6 NW> <SU 3 6 NE>
#>
bng_to_parent(as_bng_reference("SU36SW"))
#> <BNGReference[1] with Resolution=10km>
#> [1] <SU 3 6>
bng_to_parent(as_bng_reference("SU342567"))
#> <BNGReference[1] with Resolution=500m>
#> [1] <SU 34 56 NW>
bng_to_parent(as_bng_reference("SU342567"), resolution = 10000)
#> <BNGReference[1] with Resolution=10km>
#> [1] <SU 3 5>