Crate icao_wgs84

Source
Expand description

icao-wgs84

crates.io docs.io License Rust codecov

A library for performing geometric calculations on the WGS-84 ellipsoid, see Figure 1.

Figure 1 The WGS-84 Ellipsoid (not to scale)
Cmglee, CC BY-SA 4.0, via Wikimedia Commons

WGS-84 has become the de facto standard for satellite navigation since its adoption by the Navstar Global Positioning System (GPS) and the USA making GPS available for civilian use in 1983.

This library uses the WGS-84 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 (orange) path and great circle (blue) path

This library uses the correspondence between geodesics on an ellipsoid and great-circles on an 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.

See: geodesic algorithms.

§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 Ellipsoid class represents an ellipsoid of revolution. The static WGS84_ELLIPSOID represents the WGS-84 Ellipsoid which is used by the Geodesic From traits to create Geodesics on the WGS-84 Ellipsoid.

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§

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

Structs§

Angle
An angle represented by it’s sine and cosine as UnitNegRanges.
Degrees
The Degrees newtype an f64.
Ellipsoid
The parameters of an Ellipsoid.
Geodesic
A geodesic path on the surface of an ellipsoid.
LatLong
A position as a latitude and longitude pair of Degrees.
Metres
A Metres newtype for representing distance.
NauticalMiles
A Nautical Mile newtype for representing distance.
Radians
The Radians newtype an f64.
WGS84_ELLIPSOID
A static instance of the WGS-84 Ellipsoid.

Traits§

Validate
The Validate trait.

Functions§

calculate_azimuth_and_geodesic_length
Calculate the azimuth and geodesic length (in metres) between a pair of positions on the ellipsoid.
calculate_intersection_distances
Calculate the distances along a pair of Geodesics (in Radians) to their closest intersection or reference points.
calculate_intersection_point
Calculate the position (Latitude and Longitude) where a pair of Geodesics intersect, or None if the Geodesics do not intersect.