[−][src]Struct geographiclib::Geodesic
Ellipsoid on which Geodesic Calculations are computed
Methods
impl Geodesic
[src]
pub fn wgs84() -> Self
[src]
Create a new WGS84 Ellipsoid
- Semi-major Axis: 6_378_137.0
- Flattening: 1.0/298.257_223_563
pub fn ellipsoid(name: Ellipsoid) -> Self
[src]
Create a new Ellipsoid from currently existing versions
For a complete list see the Ellipsoid enum
pub fn new(a: f64, f: f64) -> Self
[src]
Create new Ellipsoid with semi-major axis a
in meters and a flattening f
Most users will likely want either wgs84 or ellipsoid for well defined and recongized Ellipsoids
use geographiclib::Geodesic; let g = Geodesic::new(6_378_145.0, 1.0/298.25); println!("{}", g); // Geodesic { a: 6378145, f: 0.003352891869237217 }
pub fn inverse(
&self,
lat1: f64,
lon1: f64,
lat2: f64,
lon2: f64
) -> (f64, f64, f64, f64)
[src]
&self,
lat1: f64,
lon1: f64,
lat2: f64,
lon2: f64
) -> (f64, f64, f64, f64)
Compute distance and azimuth from (lat1
,lon1
) to (lat2
,lon2
)
Arguments
- lat1: Latitude of 1st point [degrees] [-90., 90.]
- lon1: Longitude of 1st point [degrees] [-180., 180.]
- lat2: Latitude of 2nd point [degrees] [-90. 90]
- lon2: Longitude of 2nd point [degrees] [-180., 180.]
Returns
- a12 - Distance from 1st to 2nd point [degrees]
- s12 - Distance from 1st to 2nd point [degrees]
- azi1 - Azimuth at 1st point [degrees]
- azi2 - Azimuth at 2nd point [degrees]
If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+.
The solution to the inverse problem is found using Newton's method. If this fails to converge (this is very unlikely in geodetic applications but does occur for very eccentric ellipsoids), then the bisection method is used to refine the solution.
// Example, determine the distance between JFK and Singapore Changi Airport: use geographiclib::Geodesic; let g = Geodesic::wgs84(); let (jfk_lat, jfk_lon) = (40.64, -73.78); let (sin_lat, sin_lon) = (1.36, 103.99); let (d, m, a1, a2) = g.inverse(jfk_lat, jfk_lon, sin_lat, sin_lon); assert_eq!(d, 138.0511907301622); // Distance degrees assert_eq!(m, 15347512.94051294); // Distance meters assert_eq!(a1, 3.3057734780176125); // Azimuth at 1st point assert_eq!(a2, 177.48784020815515); // Azimuth at 2nd point (forward)
pub fn direct(
&self,
lat1: f64,
lon1: f64,
azi1: f64,
s12: f64
) -> (f64, f64, f64)
[src]
&self,
lat1: f64,
lon1: f64,
azi1: f64,
s12: f64
) -> (f64, f64, f64)
Compute a new location (lat2
,lon2
) from (lat1
,lon1
) a distance s12
at an azimuth of azi1
Arguments
- lat1 - Latitude of 1st point [degrees] [-90.,90.]
- lon1 - Longitude of 1st point [degrees] [-180., 180.]
- azi1 - Azimuth at 1st point [degrees] [-180., 180.]
- s12 - Distance from 1st to 2nd point [meters] Value may be negative
Returns
- lat2 - Latitude of 2nd point [degrees]
- lon2 - Longitude of 2nd point [degrees]
- azi2 - Azimuth at 2nd point
If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+. An arc length greater that 180° signifies a geodesic which is not a shortest path. (For a prolate ellipsoid, an additional condition is necessary for a shortest path: the longitudinal extent must not exceed of 180°.)
// Example, determine the point 10000 km NE of JFK: use geographiclib::Geodesic; let g = Geodesic::wgs84(); let (lat,lon,az) = g.direct(40.64, -73.78, 45.0, 10e6); assert_eq!(lat, 32.621100463725796); assert_eq!(lon, 49.05248709295982); assert_eq!(az, 140.4059858768007);
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,