osbng.bng_reference.BNGReference.bng_to_parent#

BNGReference.bng_to_parent(*, resolution: int | str | None = None) BNGReference[source]#

Returns the BNGReference that is the parent of this BNGReference.

By default, the parent of the BNGReference object is defined as the BNGReference in the next BNG resolution up from the current BNGReference resolution. For example, 50km -> 100km.

Notes

Any valid resolution can be provided as the parent resolution, provided it is greater than the resolution of the current BNGReference object.

Keyword Arguments:

resolution (int | str | None, optional) – The resolution of the parent BNGReference objects expressed either as a metre-based integer or as a string label. Defaults to None.

Returns:

A BNGReference object that is

the parent of the current BNGReference object.

Return type:

BNGReference

Raises:

Examples

>>> BNGReference("SU 3 6 SW").bng_to_parent()
BNGReference(bng_ref_formatted=SU 3 6, resolution_label=10km)
>>> BNGReference("SU 342 567").bng_to_parent()
BNGReference(bng_ref_formatted=SU 34 56 NW, resolution_label=500m)
>>> BNGReference("SU 342 567").bng_to_parent(resolution=10000)
BNGReference(bng_ref_formatted=SU 3 5, resolution_label=10km)

See also

The equivalent osbng.hierarchy.bng_to_parent() function.