Package pygeodesy :: Module ellipsoidalKarney :: Class LatLon
[frames] | no frames]

Class LatLon

               object --+                
                        |                
              bases.Named --+            
                            |            
                  bases.Based --+        
                                |        
           bases.LatLonHeightBase --+    
                                    |    
ellipsoidalBase.LatLonEllipsoidalBase --+
                                        |
                                       LatLon

An ellipsoidal LatLon similar to ellipsoidalVincenty.LatLon but using Charles F. F. Karney's Python GeographicLib to compute the geodesic distance, initial and final bearing (azimuths) between two given points or the destination point given a start point and an initial bearing.


Note: This LatLon's methods require the GeographicLib package to be installed.

Instance Methods
 
destination(self, distance, bearing, height=None)
Compute the destination point after having travelled for the given distance from this point along a geodesic given by an initial bearing, using Karney's direct method.
 
destination2(self, distance, bearing, height=None)
Compute the destination point and the final bearing (reverse azimuth) after having travelled for the given distance from this point along a geodesic given by an initial bearing, using Karney's direct method.
 
distanceTo(self, other, wrap=False)
Compute the distance between this and an other point along a geodesic, using Karney's inverse method.
 
distanceTo3(self, other, wrap=False)
Compute the distance, the initial and final bearing along a geodesic between this and an other point, using Karney's inverse method.
 
finalBearingOn(self, distance, bearing)
Compute the final bearing (reverse azimuth) after having travelled for the given distance along a geodesic given by an initial bearing from this point, using Karney's direct method.
 
finalBearingTo(self, other, wrap=False)
Compute the final bearing (reverse azimuth) after having travelled along a geodesic from this point to an other point, using Karney's inverse method.
 
initialBearingTo(self, other, wrap=False)
Compute the initial bearing (forward azimuth) to travel along a geodesic from this point to an other point, using Karney's inverse method.
 
bearingTo(self, other, wrap=False)
Compute the initial bearing (forward azimuth) to travel along a geodesic from this point to an other point, using Karney's inverse method.
 
toCartesian(self)
Convert this (geodetic) point to (geocentric) x/y/z Cartesian coordinates.

Inherited from ellipsoidalBase.LatLonEllipsoidalBase: __init__, antipode, convertDatum, distanceTo2, elevation2, ellipsoid, ellipsoids, geoidHeight2, parse, to3xyz, toOsgr, toUtm, toWm

Inherited from bases.LatLonHeightBase: __eq__, __ne__, __str__, bounds, copy, equals, equals3, isantipode, points, to2ab, to3llh, toStr

Inherited from bases.Based: __repr__, classof, others, toStr2

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties
  geodesic
Get this LatLon's Geodesic.

Inherited from ellipsoidalBase.LatLonEllipsoidalBase: convergence, datum, isEllipsoidal, isSpherical, scale

Inherited from bases.LatLonHeightBase: height, lat, latlon, lon

Inherited from bases.Named: classname, classnaming, name

Inherited from object: __class__

Method Details

destination(self, distance, bearing, height=None)

 

Compute the destination point after having travelled for the given distance from this point along a geodesic given by an initial bearing, using Karney's direct method. See method destination2 for more details.

Parameters:
  • distance - Distance in meters (scalar).
  • bearing - Initial bearing in compass degrees (scalar).
  • height - Optional height, overriding the default height (meter).
Returns:
The destination point (LatLon).
Raises:

Example:

>>> p = LatLon(-37.95103, 144.42487)
>>> d = p.destination(54972.271, 306.86816)
>>> d
LatLon(37°39′10.14″S, 143°55′35.39″E)  # 37.652818°S, 143.926498°E

destination2(self, distance, bearing, height=None)

 

Compute the destination point and the final bearing (reverse azimuth) after having travelled for the given distance from this point along a geodesic given by an initial bearing, using Karney's direct method.

The distance must be in the same units as this point's datum axes, conventionally meter. The distance is measured on the surface of the ellipsoid, ignoring this point's height.

The initial and final bearing (aka forward and reverse azimuth) are in compass degrees.

The destination point's height and datum are set to this point's height and datum.

Parameters:
  • distance - Distance in meters (scalar).
  • bearing - Initial bearing in compass degrees (scalar).
  • height - Optional height, overriding the default height (meter).
Returns:
2-Tuple (destination, final bearing) in (LatLon, degrees360).
Raises:

Example:

>>> p = LatLon(-37.95103, 144.42487)
>>> d, f = p.destination2(54972.271, 306.86816)
>>> d
LatLon(37°39′10.14″S, 143°55′35.39″E)  # 37.652818°S, 143.926498°E
>>> f
307.1736313846665

distanceTo(self, other, wrap=False)

 

Compute the distance between this and an other point along a geodesic, using Karney's inverse method. See method distanceTo3 for more details.

Parameters:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Distance in meters (scalar).
Raises:
  • TypeError - The other point is not LatLon.
  • ValueError - If this and the other point's Datum ellipsoids are not compatible.
  • ImportError - Package GeographicLib missing.

Example:

>>> p = LatLon(50.06632, -5.71475)
>>> q = LatLon(58.64402, -3.07009)
>>> d = p.distanceTo(q)  # 969,954.1663142084 m

distanceTo3(self, other, wrap=False)

 

Compute the distance, the initial and final bearing along a geodesic between this and an other point, using Karney's inverse method.

The distance is in the same units as this point's datum axes, conventially meter. The distance is measured on the surface of the ellipsoid, ignoring this point's height.

The initial and final bearing (aka forward and reverse azimuth) are in compass degrees from North.

Parameters:
  • other - Destination point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
3-Tuple (distance, initial bearing, final bearing) in (meter, degrees360, degree360).
Raises:
  • TypeError - The other point is not LatLon.
  • ValueError - If this and the other point's Datum ellipsoids are not compatible.

finalBearingOn(self, distance, bearing)

 

Compute the final bearing (reverse azimuth) after having travelled for the given distance along a geodesic given by an initial bearing from this point, using Karney's direct method. See method destination2 for more details.

Parameters:
  • distance - Distance in meter (scalar).
  • bearing - Initial bearing (compass degrees).
Returns:
Final bearing from North (degrees360).
Raises:

Example:

>>> p = LatLon(-37.95103, 144.42487)
>>> b = 306.86816
>>> f = p.finalBearingOn(54972.271, b)  # 307.1736313846665°

finalBearingTo(self, other, wrap=False)

 

Compute the final bearing (reverse azimuth) after having travelled along a geodesic from this point to an other point, using Karney's inverse method. See method distanceTo3 for more details.

Parameters:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Final bearing in compass degrees (degrees360).
Raises:
  • ImportError - Package GeographicLib missing.
  • TypeError - The other point is not LatLon.
  • ValueError - If this and the other point's Datum ellipsoids are not compatible.

Example:

>>> p = new LatLon(50.06632, -5.71475)
>>> q = new LatLon(58.64402, -3.07009)
>>> f = p.finalBearingTo(q)  # 11.297220414306684°
>>> p = LatLon(52.205, 0.119)
>>> q = LatLon(48.857, 2.351)
>>> f = p.finalBearingTo(q)  # 157.83449958372714°

initialBearingTo(self, other, wrap=False)

 

Compute the initial bearing (forward azimuth) to travel along a geodesic from this point to an other point, using Karney's inverse method. See method distanceTo3 for more details.

Parameters:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Initial bearing in compass degrees (degrees360).
Raises:
  • ImportError - Package GeographicLib missing.
  • TypeError - The other point is not LatLon.
  • ValueError - If this and the other point's Datum ellipsoids are not compatible.

Example:

>>> p = LatLon(50.06632, -5.71475)
>>> q = LatLon(58.64402, -3.07009)
>>> b = p.initialBearingTo(q)  # 9.141877488906045°
>>> p = LatLon(52.205, 0.119)
>>> q = LatLon(48.857, 2.351)
>>> b = p.initialBearingTo(q)  # 156.1106404059787°

JS name: bearingTo.

bearingTo(self, other, wrap=False)

 

Compute the initial bearing (forward azimuth) to travel along a geodesic from this point to an other point, using Karney's inverse method. See method distanceTo3 for more details.

Parameters:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Initial bearing in compass degrees (degrees360).
Raises:
  • ImportError - Package GeographicLib missing.
  • TypeError - The other point is not LatLon.
  • ValueError - If this and the other point's Datum ellipsoids are not compatible.

Example:

>>> p = LatLon(50.06632, -5.71475)
>>> q = LatLon(58.64402, -3.07009)
>>> b = p.initialBearingTo(q)  # 9.141877488906045°
>>> p = LatLon(52.205, 0.119)
>>> q = LatLon(48.857, 2.351)
>>> b = p.initialBearingTo(q)  # 156.1106404059787°

JS name: bearingTo.

toCartesian(self)

 

Convert this (geodetic) point to (geocentric) x/y/z Cartesian coordinates.

Returns:
Ellipsoidal (geocentric) Cartesian point (Cartesian).

Property Details

geodesic

Get this LatLon's Geodesic.

Get Method:
geodesic(self) - Get this LatLon's Geodesic.
Set Method:
Read_Only(self, ignored) - Throws an AttributeError, always.