Crate icao_wgs84

source ·
Expand description

icao-wgs84

crates.io docs.io License Rust codecov

A library for performing geometric calculations on the WGS84 ellipsoid, see Figure 1.

Figure 1 The WGS84 Ellipsoid (not to scale)

WGS84 has become the de facto standard for satellite navigation since its adoption by the Navstar Global Positioning System (GPS) and US president Ronald Reagan’s 1983 decision to make GPS available for civilian use after airliner KAL 007 was shot down by Soviet interceptor aircraft when it strayed into prohibited airspace due to navigational errors.

This library uses the WGS84 primary parameters defined in Tab. 3-1 of the ICAO WGS 84 Implementation Manual.

§Geodesic navigation

The shortest path between two points on the surface of an ellipsoid is a geodesic - the equivalent of straight line segments in planar geometry or great circles on the surface of a sphere, see Figure 2.

Figure 2 A geodesic between points A and B

Karney(2013) solves geodesic problems by mapping a geodesic onto the auxiliary sphere and then solving the corresponding problem in great-circle navigation.

Baselga and Martinez-Llario(2017) solve geodesic intersection and point-to-line problems by using the correspondence between geodesics on an ellipsoid and great-circles on the auxiliary sphere.

Nick Korbey and I Barker and Korbey(2019) developed Baselga and Martinez-Llario’s algorithms by using vectors to solve geodesic intersection and point-to-line problems on the auxiliary sphere.

This library also uses the correspondence between geodesics on an ellipsoid and great-circles on the auxiliary sphere together with 3D vectors to calculate:

  • the initial azimuth and length of a geodesic between two positions;
  • the along track distance and across track distance of a position relative to a geodesic;
  • and the intersection of a pair of geodesics.

§Design

The library is based on Charles Karney’s GeographicLib library. Like GeographicLib, it models geodesic paths as great circles on the surface of an auxiliary sphere. However, it also uses vectors to calculate along track distances, across track distances and intersections between geodesics.

The library depends upon the following crates:

  • angle-sc - to define Angle, Degrees and Radians and perform trigonometric calculations;
  • unit-sphere - to define LatLong and perform great-circle and vector calculations.
  • icao_units - to define Metres and NauticalMiles and perform conversions between them.

The library is declared no_std so it can be used in embedded applications.

Modules§

  • The ellipsoid module contains types and functions for defining an ellipsoid given its Semimajor axis (the equivalent of its radius) and flattening ratio.
  • The geodesic module contains functions for calculating the geodesic path between two points on the surface of an ellipsoid.

Structs§

  • An angle represented by it’s sine and cosine as UnitNegRanges.
  • The Degrees newtype an f64.
  • The parameters of an Ellipsoid.
    The default value is the WGS84 Ellipsoid.
  • A geodesic path on the surface of an ellipsoid.
  • A position as a latitude and longitude pair of Degrees.
  • A Metres newtype for representing distance.
  • A Nautical Mile newtype for representing distance.
    Used in navigation, generally for distances in excess of 4 000 m.
  • The Radians newtype an f64.

Traits§

Functions§