osbng.bng_reference.BNGReference.bng_to_xy#

BNGReference.bng_to_xy(*, position: str = 'lower-left') tuple[int | float, int | float][source]#

Returns easting and northing coordinates of this BNGReference.

An optional grid square position keyword argument can be specified to return the coordinates of a specific corner or the centre of the grid square.

Keyword Arguments:

position (str, optional) – The grid square position expressed as a string. One of: ‘lower-left’, ‘upper-left’, ‘upper-right’, ‘lower-right’, ‘centre’.

Returns:

Easting and northing coordinates as a

tuple.

Return type:

tuple[int | float, int | float]

Raises:

ValueError – If invalid position provided.

Example

>>> BNGReference("SU").bng_to_xy()
(400000, 100000)
>>> BNGReference("SU 3 1").bng_to_xy()
(430000, 110000)
>>> BNGReference("SU 3 1 NE").bng_to_xy("centre")
(437500, 117500)
>>> BNGReference("SU 37289 15541").bng_to_xy("centre")
(437289.5, 115541.5)

See also

The equivalent osbng.indexing.bng_to_xy() function.