Package pygeodesy :: Module sphericalBase :: Class LatLonSphericalBase
[frames] | no frames]

Class LatLonSphericalBase

   object --+            
            |            
 named._Named --+        
                |        
 named._NamedBase --+    
                    |    
latlonBase.LatLonBase --+
                        |
                       LatLonSphericalBase
Known Subclasses:

(INTERNAL) Base class for spherical LatLons.

Instance Methods
 
__init__(self, lat, lon, height=0, datum=None, name='')
Create a spherical LatLon point frome the given lat-, longitude and height on the given datum.
 
bearingTo2(self, other, wrap=False, raiser=False)
Return the initial and final bearing (forward and reverse azimuth) from this to an other point.
 
finalBearingTo(self, other, wrap=False, raiser=False)
Return the final bearing (reverse azimuth) from this to an other point.
 
maxLat(self, bearing)
Return the maximum latitude reached when travelling on a great circle on given bearing from this point based on Clairaut's formula.
 
minLat(self, bearing)
Return the minimum latitude reached when travelling on a great circle on given bearing from this point.
 
parse(self, strll, height=0, sep=',')
Parse a string representing lat-/longitude point and return a LatLon.
 
rhumbBearingTo(self, other)
Return the initial bearing (forward azimuth) from this to an other point along a rhumb (loxodrome) line.
 
rhumbDestination(self, distance, bearing, radius=6371008.77141, height=None)
Return the destination point having travelled along a rhumb (loxodrome) line from this point the given distance on the given bearing.
 
rhumbDistanceTo(self, other, radius=6371008.77141)
Return the distance from this to an other point along a rhumb (loxodrome) line.
 
rhumbMidpointTo(self, other, height=None)
Return the (loxodromic) midpoint between this and an other point.
 
toWm(self, radius=6378137.0)
Convert this LatLon point to a WM coordinate.

Inherited from latlonBase.LatLonBase: __eq__, __ne__, __str__, antipode, bounds, boundsOf, compassAngle, compassAngleTo, copy, equals, equals3, equirectangularTo, euclideanTo, haversineTo, isantipode, isantipodeTo, isequalTo, isequalTo3, latlon2, latlon2round, latlon_, philam2, points, points2, to2ab, to3llh, to3xyz, toCartesian, toEcef, toNvector, toStr, toVector, toVector3d, vincentysTo

Inherited from named._NamedBase: __repr__, others, toStr2

Inherited from named._Named: __copy__, classof

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

Properties
  datum
Get this point's datum (Datum).
  isEllipsoidal
Check whether this LatLon is ellipsoidal (bool).
  isSpherical
Check whether this LatLon is spherical (bool).

Inherited from latlonBase.LatLonBase: Ecef, height, lat, latlon, latlonheight, lon, philam, philamheight

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

Inherited from object: __class__

Method Details

__init__(self, lat, lon, height=0, datum=None, name='')
(Constructor)

 

Create a spherical LatLon point frome the given lat-, longitude and height on the given datum.

Parameters:
  • lat - Latitude (degrees or DMS [N|S]).
  • lon - Longitude (degrees or DMS str[E|W]).
  • height - Optional elevation (meter, the same units as the datum's half-axes).
  • datum - Optional, shperical datum to use (Datum).
  • name - Optional name (string).
Returns:
New instance (LatLon).
Raises:
  • TypeError - datum is not a datum or not spherical.
Overrides: object.__init__

Example:

>>> p = LatLon(51.4778, -0.0016)  # height=0, datum=Datums.WGS84

bearingTo2(self, other, wrap=False, raiser=False)

 

Return the initial and final bearing (forward and reverse azimuth) from this to an other point.

Parameters:
  • other - The other point (LatLon).
  • wrap - Wrap and unroll longitudes (bool).
  • raiser - Optionally, raise CrossError (bool).
Returns:
A Bearing2Tuple(initial, final).
Raises:
  • TypeError - The other point is not spherical.

See Also: Methods initialBearingTo and finalBearingTo.

finalBearingTo(self, other, wrap=False, raiser=False)

 

Return the final bearing (reverse azimuth) from this to an other point.

Parameters:
  • other - The other point (spherical LatLon).
  • wrap - Wrap and unroll longitudes (bool).
  • raiser - Optionally, raise CrossError (bool).
Returns:
Final bearing (compass degrees360).
Raises:
  • TypeError - The other point is not spherical.

Example:

>>> p = LatLon(52.205, 0.119)
>>> q = LatLon(48.857, 2.351)
>>> b = p.finalBearingTo(q)  # 157.9

maxLat(self, bearing)

 

Return the maximum latitude reached when travelling on a great circle on given bearing from this point based on Clairaut's formula.

The maximum latitude is independent of longitude and the same for all points on a given latitude.

Negate the result for the minimum latitude (on the Southern hemisphere).

Parameters:
  • bearing - Initial bearing (compass degrees360).
Returns:
Maximum latitude (degrees90).

JS name: maxLatitude.

minLat(self, bearing)

 

Return the minimum latitude reached when travelling on a great circle on given bearing from this point.

Parameters:
  • bearing - Initial bearing (compass degrees360).
Returns:
Minimum latitude (degrees90).

See Also: Method maxLat for more details.

JS name: minLatitude.

parse(self, strll, height=0, sep=',')

 

Parse a string representing lat-/longitude point and return a LatLon.

The lat- and longitude must be separated by a sep[arator] character. If height is present it must follow and be separated by another sep[arator]. Lat- and longitude may be swapped, provided at least one ends with the proper compass direction.

For more details, see functions parse3llh and parseDMS in module dms.

Parameters:
  • strll - Lat, lon [, height] (str).
  • height - Optional , default height (meter).
  • sep - Optional separator (str).
Returns:
The point (spherical LatLon).
Raises:
  • ValueError - Invalid strll.

rhumbBearingTo(self, other)

 

Return the initial bearing (forward azimuth) from this to an other point along a rhumb (loxodrome) line.

Parameters:
  • other - The other point (spherical LatLon).
Returns:
Initial bearing (compass degrees360).
Raises:
  • TypeError - The other point is not spherical.

Example:

>>> p = LatLon(51.127, 1.338)
>>> q = LatLon(50.964, 1.853)
>>> b = p.rhumbBearingTo(q)  # 116.7

rhumbDestination(self, distance, bearing, radius=6371008.77141, height=None)

 

Return the destination point having travelled along a rhumb (loxodrome) line from this point the given distance on the given bearing.

Parameters:
  • distance - Distance travelled (meter, same units as radius).
  • bearing - Bearing from this point (compass degrees360).
  • radius - Optional, mean earth radius (meter).
  • height - Optional height, overriding the default height (meter, same unit as radius).
Returns:
The destination point (spherical LatLon).

Example:

>>> p = LatLon(51.127, 1.338)
>>> q = p.rhumbDestination(40300, 116.7)  # 50.9642°N, 001.8530°E

JS name: rhumbDestinationPoint

rhumbDistanceTo(self, other, radius=6371008.77141)

 

Return the distance from this to an other point along a rhumb (loxodrome) line.

Parameters:
  • other - The other point (spherical LatLon).
  • radius - Optional, mean earth radius (meter).
Returns:
Distance (meter, the same units as radius).
Raises:
  • TypeError - The other point is not spherical.

Example:

>>> p = LatLon(51.127, 1.338)
>>> q = LatLon(50.964, 1.853)
>>> d = p.rhumbDistanceTo(q)  # 403100

rhumbMidpointTo(self, other, height=None)

 

Return the (loxodromic) midpoint between this and an other point.

Parameters:
  • other - The other point (spherical LatLon).
  • height - Optional height, overriding the mean height (meter).
Returns:
The midpoint (spherical LatLon).
Raises:
  • TypeError - The other point is not spherical.

Example:

>>> p = LatLon(51.127, 1.338)
>>> q = LatLon(50.964, 1.853)
>>> m = p.rhumb_midpointTo(q)
>>> m.toStr()  # '51.0455°N, 001.5957°E'

toWm(self, radius=6378137.0)

 

Convert this LatLon point to a WM coordinate.

Parameters:
  • radius - Optional earth radius (meter).
Returns:
The WM coordinate (Wm).

See Also: Function toWm in module webmercator for details.


Property Details

datum

Get this point's datum (Datum).

Get Method:
datum(self) - Get this point's datum (Datum).
Set Method:
datum(self, datum) - Set this point's datum without conversion.

isEllipsoidal

Check whether this LatLon is ellipsoidal (bool).

Get Method:
isEllipsoidal(self) - Check whether this LatLon is ellipsoidal (bool).
Set Method:
Read_Only(self, ignored) - Throws an AttributeError, always.

isSpherical

Check whether this LatLon is spherical (bool).

Get Method:
isSpherical(self) - Check whether this LatLon is spherical (bool).
Set Method:
Read_Only(self, ignored) - Throws an AttributeError, always.