Crate lonlat_bng

Crate lonlat_bng 

Source
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
ResultTuple
A simple struct that can be leaked across the FFI boundary in lieu of an actual tuple

Constants§

NAN

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)