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

Class LatLon

               object --+                
                        |                
             named._Named --+            
                            |            
             named._NamedBase --+        
                                |        
            latlonBase.LatLonBase --+    
                                    |    
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.

Instance Methods
 
bearingTo(self, other, wrap=False)
DEPRECATED, use method initialBearingTo.
 
bearingTo2(self, other, wrap=False)
Compute the initial and final bearing (forward and reverse azimuth) from this to an other point, using Karney's Inverse method.
 
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, **unused)
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.
 
intersections2(self, radius1, other, radius2, height=None, wrap=True, tol=0.001)
Compute the intersection points of two circles each defined by a center point and a radius.
 
nearestOn(self, point1, point2, within=True, height=None, wrap=False, tol=0.001)
Locate the closest point on the arc between two other points and this point.
 
toCartesian(self, **Cartesian_datum_kwds)
Convert this point to Karney-based cartesian (ECEF) coordinates.

Inherited from ellipsoidalBase.LatLonEllipsoidalBase: __init__, antipode, convertDatum, convertRefFrame, distanceTo2, elevation2, ellipsoid, ellipsoids, geoidHeight2, parse, to3xyz, toEtm, toLcc, toOsgr, toUps, toUtm, toUtmUps, toWm, trilaterate5

Inherited from latlonBase.LatLonBase: __eq__, __ne__, __str__, _distanceTo_, bounds, boundsOf, compassAngle, compassAngleTo, cosineAndoyerLambertTo, cosineForsytheAndoyerLambertTo, cosineLawTo, equals, equals3, equirectangularTo, euclideanTo, flatLocalTo, flatPolarTo, haversineTo, heightStr, hubenyTo, isantipode, isantipodeTo, isequalTo, isequalTo3, latlon2, latlon2round, latlon_, philam2, points, points2, thomasTo, to2ab, to3llh, toEcef, toNvector, toStr, toVector, toVector3d, vincentysTo

Inherited from named._NamedBase: __repr__, others, toRepr

Inherited from named._Named: _dot_, attrs, classof, copy, toStr2

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

Properties
  geodesic
Get this LatLon's wrapped Karney Geodesic, provided package geographiclib is installed.

Inherited from ellipsoidalBase.LatLonEllipsoidalBase: convergence, datum, epoch, iteration, reframe, scale

Inherited from latlonBase.LatLonBase: Ecef, height, isEllipsoidal, isSpherical, lam, lat, latlon, latlonheight, lon, phi, philam, philamheight, xyz, xyzh

Inherited from named._Named: classname, classnaming, name, named, named2, named3, named4

Inherited from object: __class__

Method Details

bearingTo2 (self, other, wrap=False)

 

Compute the initial and final bearing (forward and reverse azimuth) from this to an other point, using Karney's Inverse method. See methods initialBearingTo and finalBearingTo for more details.

Arguments:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
A Bearing2Tuple(initial, final).
Raises:
  • ImportError - Package geographiclib not installed or not found.
  • TypeError - The other point is not LatLon.
  • ValueError - If this and the other point's Datum ellipsoids are not compatible.

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.

Arguments:
  • distance - Distance (meter).
  • bearing - Initial bearing in (compass degrees360).
  • height - Optional height, overriding the default height (meter, same units as distance).
Returns:
The destination point (LatLon).
Raises:
  • ImportError - Package geographiclib not installed or not found.

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 (forward and reverse azimuth) are in compass degrees360.

The destination point's height and datum are set to this point's height and datum, unless the former is overridden.

Arguments:
  • distance - Distance (meter).
  • bearing - Initial bearing (compass degrees360).
  • height - Optional height, overriding the default height (meter, same units as distance).
Returns:
A Destination2Tuple(destination, final).
Raises:
  • ImportError - Package geographiclib not installed or not found.

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, **unused)

 

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

Arguments:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Distance (meter).
Raises:
  • ImportError - Package geographiclib not installed or not found.
  • 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)
>>> 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, conventionally meter. The distance is measured on the surface of the ellipsoid, ignoring this point's height.

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

Arguments:
  • other - Destination point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
A Distance3Tuple(distance, initial, final).
Raises:
  • ImportError - Package geographiclib not installed or not found.
  • 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.

Arguments:
  • distance - Distance (meter).
  • bearing - Initial bearing (compass degrees360).
Returns:
Final bearing (compass degrees360).
Raises:
  • ImportError - Package geographiclib not installed or not found.

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.

Arguments:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Final bearing (compass degrees360).
Raises:
  • ImportError - Package geographiclib not installed or not found.
  • 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.

Arguments:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Initial bearing (compass degrees360).
Raises:
  • ImportError - Package geographiclib not installed or not found.
  • 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.

intersections2 (self, radius1, other, radius2, height=None, wrap=True, tol=0.001)

 

Compute the intersection points of two circles each defined by a center point and a radius.

Arguments:
  • radius1 - Radius of the this circle (meter).
  • other - Center of the other circle (LatLon).
  • radius2 - Radius of the other circle (meter).
  • height - Optional height for the intersection points, overriding the "radical height" at the "radical line" between both centers (meter) or None.
  • wrap - Wrap and unroll longitudes (bool).
  • tol - Convergence tolerance (meter).
Returns:
2-Tuple of the intersection points, each a LatLon instance. For abutting circles, the intersection points are the same instance.
Raises:
  • IntersectionError - Concentric, antipodal, invalid or non-intersecting circles or no convergence.
  • ImportError - Package geographiclib not installed or not found.
  • TypeError - Invalid other or equidistant.
  • ValueError - Invalid radius1, radius2 or height.
Overrides: ellipsoidalBase.LatLonEllipsoidalBase.intersections2

nearestOn (self, point1, point2, within=True, height=None, wrap=False, tol=0.001)

 

Locate the closest point on the arc between two other points and this point.

Arguments:
  • point1 - Start point of the arc (LatLon).
  • point2 - End point of the arc (LatLon).
  • within - If True return the closest point between point1 and point2, otherwise the closest point elsewhere on the arc (bool).
  • height - Optional height for the closest point (meter) or None.
  • wrap - Wrap and unroll longitudes (bool).
  • tol - Convergence tolerance (meter).
Returns:
Closest point (LatLon).
Raises:
  • ImportError - Package geographiclib not installed or not found.
  • TypeError - Invalid or non-ellipsoidal point1 or point2.
Overrides: ellipsoidalBase.LatLonEllipsoidalBase.nearestOn

toCartesian (self, **Cartesian_datum_kwds)

 

Convert this point to Karney-based cartesian (ECEF) coordinates.

Arguments:
  • Cartesian_datum_kwds - Optional Cartesian, datum and other keyword arguments, ignored if Cartesian=None. Use Cartesian=... to override this Cartesian class or set Cartesian=None.
Returns:
The cartesian (ECEF) coordinates (Cartesian) or if Cartesian is None, an Ecef9Tuple(x, y, z, lat, lon, height, C, M, datum) with C and M if available.
Raises:
  • TypeError - Invalid Cartesian, datum or other Cartesian_datum_kwds.
Overrides: latlonBase.LatLonBase.toCartesian

Property Details

geodesic

Get this LatLon's wrapped Karney Geodesic, provided package geographiclib is installed.

Get method:
geodesic(self) - Get this LatLon's wrapped Karney Geodesic, provided package geographiclib is installed.
Set method:
immutable(inst, value) - Throws an AttributeError, always.