Skip to content

Commit 3dbf3d3

Browse files
authored
Use latest liblonlat_bng (#110)
1 parent b8b1d37 commit 3dbf3d3

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ A utility library for converting decimal [WGS84](http://spatialreference.org/ref
66
Conversion is handled by a [Rust binary](https://github.com/urschrei/rust_bng) using FFI, and is quite fast. Some benchmarks can be found [here](https://github.com/urschrei/lonlat_bng#benchmark).
77

88
# Installation
9-
- `pip install convertbng`
109
- `uv add convertbng`
10+
- `pip install convertbng`
1111

1212
## Installing for local development
1313
1. Ensure you have a copy of `liblonlat_bng` and `header.h` from https://github.com/urschrei/lonlat_bng/releases, and it's in the `src/convertbng` subdir
@@ -65,6 +65,17 @@ lats_np = np.array(lats)
6565
res_list_np = convert_bng(lons_np, lats_np)
6666
```
6767

68+
# Accuracy
69+
The [Rust library](https://github.com/urschrei/lonlat_bng) produces the following results when round-tripping the 40 OSTN15 test points (only differences are shown)
70+
71+
| Test Point | Input OSGB36 E (m) | Input OSGB36 N (m) | Lon diff (°) | Lat diff (°) | E diff (m) | N diff (m) |
72+
|:-----------|-------------------:|-------------------:|-------------:|-------------:|-----------:|-----------:|
73+
| TP27 | 319188.434 | 670947.534 |||| +0.001 |
74+
| TP31 | 9587.909 | 899448.996 | +6×10⁻⁸ | -3×10⁻⁸ | +0.003 | -0.004 |
75+
| TP32 | 71713.132 | 938516.404 | +2×10⁻⁸ | -1×10⁻⁸ | +0.001 | -0.002 |
76+
| TP37 | 180862.461 | 1029604.114 |||| -0.001 |
77+
| TP38 | 421300.525 | 1072147.239 |||| -0.001 |
78+
6879
# Cython Module
6980
If you're comfortable with restricting yourself to `NumPy f64` arrays, you may use the Cython functions instead. These are identical to those listed below, but performance on large datasets is better. They are selected by changing the import statement
7081
`from convertbng.util import` to

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "convertbng"
3-
version = "0.7.9"
3+
version = "0.7.10"
44
description = "Fast lon, lat to and from ETRS89 and BNG (OSGB36) using the OS OSTN15 transform via Rust FFI"
55
readme = "README.md"
66
requires-python = ">=3.10"

tests/test_convertbng.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def test_non_convergence(self):
8080
[408884, 333642],
8181
]
8282
expected = [
83-
[-1.92485417, 53.26107641],
84-
[-1.6233221, 52.06744836],
85-
[-1.86937174, 52.90016459],
83+
[-1.92485417, 53.26107642],
84+
[-1.62332209, 52.06744836],
85+
[-1.86937175, 52.9001646],
8686
]
8787
for i, j in zip(extremes, expected):
8888
exp = ([j[0]], [j[1]])
@@ -91,7 +91,7 @@ def test_non_convergence(self):
9191

9292
def testConvertBNG(self):
9393
"""Test multithreaded BNG --> lon, lat function"""
94-
expected = ([-0.32822654, -2.01831267], [51.44533145, 54.58910534])
94+
expected = ([-0.32822654, -2.01831268], [51.44533144, 54.58910534])
9595
result = convert_lonlat([516276, 398915], [173141, 521545])
9696
self.assertEqual(expected, result)
9797

@@ -231,7 +231,7 @@ def test_etrs89_to_osgb36(self):
231231

232232
def test_osgb36_to_etrs89(self):
233233
"""Tests OSGB36 --> ETRS89 Eastings, Northings conversion"""
234-
expected = ([651307.003], [313255.686])
234+
expected = ([651307.0032098937], [313255.68598407705])
235235
result = convert_osgb36_to_etrs89(651409.804, 313177.45)
236236
self.assertEqual(expected, result)
237237

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)