[−][src]Crate geographiclib

Rust interface for GeographicLib for geodesic calculations

Note: Copied directly from geodesic.h. Much more and better information can be found there.

This an implementation in C (with a Rust Interface) of the geodesic algorithms described in

Example

```use geographiclib::Geodesic;
let g = Geodesic::wgs84();
let (lat1, lon1) = (37.87622, -122.23558); // Berkeley, California
let (lat2, lon2) = (-9.4047, 147.1597);    // Port Moresby, New Guinea
let (d_deg, d_m, az1, az2) = g.inverse(lat1, lon1, lat2, lon2);

assert_eq!(d_deg, 96.39996198449684); // Distance in degrees
assert_eq!(d_m, 10700471.955233702);  // Distance in meters
assert_eq!(az1, -96.91639942294974);  // Azimuth at (lat1, lon1)
assert_eq!(az2, -127.32548874543627); // Azimuth at (lat2, lon2)```

Rationale

The principal advantages of these algorithms over previous ones (e.g., Vincenty, 1975) are

• accurate to round off for |f| < 1/50;
• the solution of the inverse problem is always found;
• differential and integral properties of geodesics are computed.

The shortest path between two points on the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has forward azimuths azi1 and azi2 at the two end points.

Traditionally two geodesic problems are considered:

• direct – given lat1, lon1, s12, and azi1, determine lat2, lon2, and azi2.
• inverse – given lat1, lon1, and lat2, lon2, determine s12, azi1, and azi2.

The ellipsoid is specified by its equatorial radius a (typically in meters) and flattening f. The routines are accurate to round off with double precision arithmetic provided that |f| < 1/50; for the WGS84 ellipsoid, the errors are less than 15 nanometers. (Reasonably accurate results are obtained for |f| < 1/5.) For a prolate ellipsoid, specify f < 0.

Structs

 Geodesic Ellipsoid on which Geodesic Calculations are computed

Enums

 Ellipsoid Used Ellipsoids and Historical Ones