Description
A Rust Crate which provides fast lookup of OSTN15 adjustments, for the conversion of ETRS89 grid coordinates to OSGB36, natively or via FFI.
Important
This library only provides the adjustment values. For a complete solution, see the lonlat_bng crate, which provides the OSTN15 transform via FFI, and / or the convertbng Python package.
Rust Crate Example
use ostn15_lookup;
// Caister Tower Eastings and Northings: 651307.003, 313255.686
let e_grid = as i32;
let n_grid = as i32;
let key = e_grid + + 1
// key is 220065
// don't use unwrap() in production
let result = ostn15_lookup.unwrap;
// result should be (102.787, -78.242, 44.236)
assert_eq!;
FFI Examples
Python
=
return
=
return
=
=
=
=
=
=
C
// compile with e.g. `clang -lostn15_phf -L target/release -o ostn15_shifts src/ostn15.c` from project root
// run with `LD_LIBRARY_PATH=target/release ./ostn15_shifts` from project root
typedef struct gridrefs;
typedef struct adjustment;
extern adjustment ;
int
Building the Shared Library
- Ensure that Rust is installed
- Clone this repo
- In the repo root, run
cargo build --release - The dylib or DLL will be available as
target/release/libostn15_phf.{dylib, dll} - If you need to build a
.sofor Linux:ar -x target/release/libostn15_phf.agcc -shared *.o -o target/release/libostn15_phf.so
License
This software makes use of OSTN15 data, which is © Crown copyright, Ordnance Survey and the Ministry of Defence (MOD) 2016. All rights reserved. Provided under the BSD 2-clause license.
