Registry / data / convertbng

convertbng

JSON →
library1.0.0pypypiunverified

Convert latitude/longitude to and from British National Grid (OSGB36) / ETRS89 coordinates using the OS OSTN15 transform. The library is powered by Rust FFI for high performance. Current version 0.7.11, requires Python >=3.10. Released irregularly.

pip install convertbng
INSTALL
IMPORT
SIG · CONVERTBNG
C
convertbng
datapythonv1.0.0
Install
4.6s avg
Import
Disk
116MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.6s · import 0.000s · 114MB
116MB installed
● package 116MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

convert_lonlat_to_bng
from convertbng import convert_lonlat_to_bng
from convertbng.util import convert_lonlat_to_bng

Convert between longitude/latitude and British National Grid coordinates. Inputs must be numpy arrays.

import numpy as np from convertbng.util import convert_lonlat_to_bng, convert_bng_to_lonlat # Example coordinates (lon, lat) lon = np.array([-0.1276, -2.0]) lat = np.array([51.5074, 53.0]) # Convert to BNG (returns (easting, northing) tuple of numpy arrays) easting, northing = convert_lonlat_to_bng(lon, lat) print(easting, northing) # Convert back to lon/lat lon_back, lat_back = convert_bng_to_lonlat(easting, northing) print(lon_back, lat_back)
Debug
Known issues
breakingInstallation may require Rust toolchain (rustc and cargo) if no precompiled wheel is available for your platform. This can cause cryptic errors on some systems.
fix
Install Rust via https://rustup.rs/ or use a conda-forge build: conda install -c conda-forge convertbng
affects: all
gotchaInput must be numpy arrays of float64 type. Passing lists or other dtypes will raise TypeError or produce wrong results.
fix
Always convert inputs to numpy arrays: np.array(values, dtype=np.float64)
affects: >=0.7.0
gotchaCoordinates outside the British National Grid coverage area (approx. 49°N–61°N, 8°W–2°E) will return NaN. Error handling not built-in; check for NaN yourself.
fix
Validate results using np.isnan(easting) or similar.
affects: all
Upgrade
Version history
1.0.0latest on PyPI · released Jun 8, 2026
Audit
Dependencies
numpyrequiredInputs and outputs are numpy arrays; required for all operations.
Agent activity
15 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
convertbng — pip install convertbng · libregistry