Expand description
The lonlat_bng crate provides functions that convert decimal (WGS84 / ETRS89) longitude
and latitude coordinates into British National Grid coordinates, and vice versa.
This library makes use of the OSTN02 transformations
These functions transform input longitude and latitude coordinates to OSGB36 Eastings and Northings with high accuracy, and are suitable for use in surveying and construction. Please run your own tests, though.
Note that lon, lat coordinates outside the UK bounding box will be transformed to (NAN, NAN), which cannot be mapped.
§Examples
// Convert single Longitude, Latitude values to OSGB36 Eastings and Northings
assert_eq!((651409.792, 313177.448), lonlat_bng::convert_osgb36(&1.716073973, &52.658007833).unwrap());// Convert vectors or slices using multi-threaded functions
lonlat_bng::convert_to_osgb36_threaded_vec(vec![&-0.32824866], vec![&51.44533267]);
lonlat_bng::convert_osgb36_to_lonlat_threaded_vec(vec![&516276], vec![&173141]);The crate also provides C-compatible wrapper functions which are intended for use with FFI.
An example FFI implementation using Python can be found at Convertbng.
Modules§
- utils
- This module provides utilities to the conversions module
Structs§
- Array
- Result
Tuple - A simple struct that can be leaked across the FFI boundary in lieu of an actual tuple
Constants§
Functions§
- convert_
epsg3857_ to_ wgs84 - Convert Web Mercator (from Google Maps or Bing Maps) to WGS84
- convert_
epsg3857_ to_ wgs84_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_epsg3857_to_wgs84 - convert_
epsg3857_ to_ wgs84_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_epsg3857_to_wgs84 - convert_
etrs89 - Perform Longitude, Latitude to ETRS89 conversion
- convert_
etrs89_ to_ ll - Convert ETRS89 coordinates to Lon, Lat
- convert_
etrs89_ to_ ll_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_etrs89_to_ll - convert_
etrs89_ to_ ll_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_etrs89_to_ll - convert_
etrs89_ to_ osgb36 - Perform ETRS89 to OSGB36 conversion, using OSTN15 data
- convert_
etrs89_ to_ osgb36_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_etrs89_to_osgb36 - convert_
etrs89_ to_ osgb36_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_etrs89_to_osgb36 - convert_
osgb36 - Perform Longitude, Latitude to OSGB36 conversion, using OSTN15 data
- convert_
osgb36_ to_ etrs89 - Convert OSGB36 coordinates to ETRS89 using OSTN15 data
- convert_
osgb36_ to_ etrs89_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_osgb36_to_etrs89 - convert_
osgb36_ to_ etrs89_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_osgb36_to_etrs89 - convert_
osgb36_ to_ ll - Convert OSGB36 coordinates to Lon, Lat using OSTN15 data
- convert_
osgb36_ to_ ll_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_osgb36_to_ll - convert_
osgb36_ to_ ll_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_osgb36_to_ll - convert_
to_ bng_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_osgb36 - convert_
to_ bng_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_osgb36 - convert_
to_ etrs89_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_etrs89 - convert_
to_ etrs89_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_etrs89 - convert_
to_ lonlat_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_osgb36_to_ll - convert_
to_ lonlat_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_osgb36_to_ll - convert_
to_ osgb36_ threaded - A threaded, FFI-compatible wrapper for
lonlat_bng::convert_osgb36 - convert_
to_ osgb36_ threaded_ vec - A threaded wrapper for
lonlat_bng::convert_osgb36 - drop_
float_ array - Free memory which Rust has allocated across the FFI boundary (f64 values)