Package pygeodesy :: Module bases :: Class LatLonHeightBase
[frames] | no frames]

Class LatLonHeightBase

object --+    
         |    
      Base --+
             |
            LatLonHeightBase
Known Subclasses:

(INTERNAL) Base class for LatLon points on spherical or ellipsiodal earth models.

Instance Methods
 
__eq__(self, other)
 
__init__(self, lat, lon, height=0)
New LatLon.
 
__ne__(self, other)
 
__str__(self)
str(x)
 
bounds(self, wide, high, radius=6371008.77141)
Return the SE and NW lat-/longitude of a great circle bounding box centered at this location.
 
copy(self)
Copy this point.
 
equals(self, other, eps=None)
Compare this point with an other point.
 
points(self, points, closed=True)
Check a polygon given as list, sequence, set or tuple of points.
 
to2ab(self)
Return this point's lat-/longitude in radians.
 
to3llh(self)
Return this point's lat-, longitude and height.
 
to3xyz(self)
Convert this (geodetic) point to (n-)vector (normal to the earth's surface) x/y/z components, ignoring the height.
 
toStr(self, form='dms', prec=None, m='m', sep=', ')
Convert this point to a "lat, lon [+/-height]" string, formatted in the given form.

Inherited from Base: __repr__, classname, classof, others, toStr2

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

Properties
  height
Get the height (meter).
  lat
Get the latitude (degrees).
  lon
Get the longitude (degrees).

Inherited from object: __class__

Method Details

__init__(self, lat, lon, height=0)
(Constructor)

 

New LatLon.

Parameters:
  • lat - Latitude (degrees or DMS string with N or S suffix).
  • lon - Longitude (degrees or DMS string with E or W suffix).
  • height - Optional height (meter above or below the earth surface).
Returns:
New instance (LatLon).
Raises:
  • ValueError - Invalid lat or lon.
Overrides: object.__init__

Example:

>>> p = LatLon(50.06632, -5.71475)
>>> q = LatLon('50°03′59″N', """005°42'53"W""")

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

bounds(self, wide, high, radius=6371008.77141)

 

Return the SE and NW lat-/longitude of a great circle bounding box centered at this location.

Parameters:
  • wide - Longitudinal box width (meter, like radius).
  • high - Latitudinal box height (meter, like radius).
  • radius - Optional earth radius (meter).
Returns:
2-Tuple (LatLonSW, LatLonNE) of (LatLons).

copy(self)

 

Copy this point.

Returns:
A copy of this point (LatLon).

equals(self, other, eps=None)

 

Compare this point with an other point.

Parameters:
  • other - The other point (LatLon).
Returns:
True if both points are identical, ignoring height (bool).
Raises:
  • TypeError - The other point is not LatLon.

Example:

>>> p = LatLon(52.205, 0.119)
>>> q = LatLon(52.205, 0.119)
>>> e = p.equals(q)  # True

points(self, points, closed=True)

 

Check a polygon given as list, sequence, set or tuple of points.

Parameters:
  • points - The points of the polygon (LatLon[])
  • closed - Treat polygon as closed (bool).
Returns:
2-Tuple (number, list) of points (int, list).
Raises:
  • TypeError - Some points are not LatLon.
  • ValueError - Too few points.

to2ab(self)

 

Return this point's lat-/longitude in radians.

Returns:
2-Tuple (lat, lon) in (radians, radians).

to3llh(self)

 

Return this point's lat-, longitude and height.

Returns:
3-Tuple (lat, lon, h) in (degrees, degrees, meter).

to3xyz(self)

 

Convert this (geodetic) point to (n-)vector (normal to the earth's surface) x/y/z components, ignoring the height.

Returns:
3-Tuple (x, y, z) in (units, NOT meter).

toStr(self, form='dms', prec=None, m='m', sep=', ')

 

Convert this point to a "lat, lon [+/-height]" string, formatted in the given form.

Parameters:
  • form - Use F_D, F_DM, F_DMS for deg°, deg°min', deg°min'sec" (string).
  • prec - Number of decimal digits (0..8 or None).
  • m - Unit of the height (string).
  • sep - Separator to join (string).
Returns:
Point in the specified form (string).
Overrides: Base.toStr

Example:

>>> LatLon(51.4778, -0.0016).toStr()  # 51°28′40″N, 000°00′06″W
>>> LatLon(51.4778, -0.0016).toStr(F_D)  # 51.4778°N, 000.0016°W
>>> LatLon(51.4778, -0.0016, 42).toStr()  # 51°28′40″N, 000°00′06″W, +42.00m


Property Details

height

Get the height (meter).

Get Method:
height(self) - Get the height (meter).
Set Method:
height(self, height) - Set the height.

lat

Get the latitude (degrees).

Get Method:
lat(self) - Get the latitude (degrees).
Set Method:
lat(self, lat) - Set the latitude (degrees).

lon

Get the longitude (degrees).

Get Method:
lon(self) - Get the longitude (degrees).
Set Method:
lon(self, lon) - Set the longitude (degrees).