Crate lonlat_bng [] [src]

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.

Note

FFI implementations must implement lonlat_bng::drop_float_array, in order to free memory which has been allocated across the FFI boundary. Failure to do so may result in memory leaks.

Modules

utils

This module provides utilities to the conversions module

Structs

Array

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 OSTN02 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 OSTN02 data

convert_osgb36_to_etrs89

Convert OSGB36 coordinates to ETRS89 using OSTN02 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 OSTN02 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)