osbng.indexing.xy_to_bng#
- osbng.indexing.xy_to_bng(easting: int | float, northing: int | float, resolution: int | str) BNGReference[source]#
Returns a
BNGReferencegiven easting and northing coordinates and resolution.- Parameters:
- Returns:
The
BNGReference.- Return type:
- Raises:
BNGResolutionError – If an invalid resolution is provided.
BNGExtentError – If the easting and northing coordinates are outside the BNG index system extent.
Examples
>>> xy_to_bng(437289, 115541, "100km") BNGReference(bng_ref_formatted=SU, resolution_label=100km) >>> xy_to_bng(437289, 115541, "10km") BNGReference(bng_ref_formatted=SU 3 1, resolution_label=10km) >>> xy_to_bng(437289, 115541, "5km") BNGReference(bng_ref_formatted=SU 3 1 NE, resolution_label=5km) >>> xy_to_bng(437289, 115541, 1) BNGReference(bng_ref_formatted=SU 37289 15541, resolution_label=1m)
See also
The
bng_to_xy()function andosbng.bng_reference.BNGReference.bng_to_xy()instance method for decoding aBNGReferenceto easting and northing coordinates.