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

# Class LatLonHeightBase

    object --+
             |
        _Named --+
                 |
            _Based --+
                     |
                    LatLonHeightBase

Known Subclasses:
  - ellipsoidalBase.LatLonEllipsoidalBase
  - , nvector.LatLonNvectorBase
  - , sphericalBase.LatLonSphericalBase

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

Instance Methods
__init__(self, lat, lon, height=0, name=`'````'`) New `LatLon`. |
__eq__(self, other) |
__ne__(self, other) |
__str__(self) str(x) |
antipode(self, height=None) Return the antipode, the point diametrically opposite to this point. |
bounds(self, wide, high, radius=6371008.77141) DEPRECATED, use method `boundsOf`. |
boundsOf(self, wide, high, radius=6371008.77141) Return the SE and NW lat-/longitude of a great circle bounding box centered at this location. |
compassAngle(self, other) DEPRECATED, use method `compassAngleTo`. |
compassAngleTo(self, other, adjust=True, wrap=False) Return the angle from North for the direction vector between this and an other point. |
copy(self) Copy this point. |
equals(self, other, eps=None) DEPRECATED, use method `isequalTo`. |
equals3(self, other, eps=None) DEPRECATED, use method `isequalTo3`. |
equirectangularTo(self, other, radius=None, **options) Compute the distance between this and an other point using the Equirectangular Approximation / Projection. |
haversineTo(self, other, radius=None, wrap=False) Compute the distance between this and an other point using the Haversine formula. |
isantipodeTo(self, other, eps=2.22044604925e-16) Check whether this and an other point are antipodal, on diametrically opposite sides of the earth. |
isantipode(self, other, eps=2.22044604925e-16) DEPRECATED, use method `isantipodeTo`. |
isequalTo(self, other, eps=None) Compare this point with an other point. |
isequalTo3(self, other, eps=None) Compare this point with an other point. |
latlon_(self, ndigits=0) DEPRECATED, use method `latlon2`. |
latlon2(self, ndigits=0) Return this point's lat- and longitude, rounded. |
latlon2round(self, ndigits=0) DEPRECATED, use method `latlon2`. |
points(self, points, closed=True) DEPRECATED, use method `points2`. |
points2(self, points, closed=True) Check a polygon represented by points. |
to2ab(self) Return this point's lat- and 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 `_Based`: `__repr__`, `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 (`degrees90`).
| latlon Get the lat- and longitude (2-tuple of `degrees90`, `degrees180`).
| lon Get the longitude (`degrees180`).
Inherited from `_Named`: `classname`, `classnaming`, `name` Inherited from `object`: `__class__`

Method Details

### __init__(self, lat, lon, height=0, name=`'````'`) (Constructor) |
New `LatLon`. Parameters: `lat` - Latitude (`degrees` or DMS `str` with N or S suffix). `lon` - Longitude (`degrees` or DMS `str` with E or W suffix). `height` - Optional height (`meter` above or below the earth surface). `name` - Optional name (`str`). Returns: New instance (`LatLon`). Raises: `RangeError` - Value of lat or lon outside the valid range and rangerrrors set to `True`. `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)

### antipode(self, height=None) |
Return the antipode, the point diametrically opposite to this point. Parameters: `height` - Optional height of the antipode, height of this point otherwise (`meter`). Returns: The antipodal point (`LatLon`).

### boundsOf(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`, same units as radius or `degrees` if radius is `None`). `high` - Latitudinal box height (`meter`, same units as radius or `degrees` if radius is `None`). `radius` - Optional, mean earth radius (`meter`). Returns: 2-Tuple (LatLonSW, LatLonNE) of (`LatLon`[]). See Also: http://www.Movable-Type.co.UK/scripts/latlong-db.html

### compassAngleTo(self, other, adjust=True, wrap=False) |
Return the angle from North for the direction vector between this and an other point. Suitable only for short, non-near-polar vectors up to a few hundred Km or Miles. Use method initialBearingTo for larger distances. Parameters: `other` - The other point (`LatLon`). `adjust` - Adjust the longitudinal delta by the cosine of the mean latitude (`bool`). `wrap` - Wrap and unroll180 longitudes and longitudinal delta (`bool`). Returns: Compass angle from North (`degrees360`). Raises: `TypeError` - The other point is not `LatLon`. Note: Courtesy Martin Schultz. See Also: Local, flat earth approximation.

### copy(self) |
Copy this point. Returns: The copy (`LatLon` or subclass thereof). Overrides: _Named.copy

### equirectangularTo(self, other, radius=None, **options) |
Compute the distance between this and an other point using the Equirectangular Approximation / Projection. Suitable only for short, non-near-polar distances up to a few hundred Km or Miles. Use method `haversineTo` or `distanceTo*` for more accurate and/or larger distances. See function equirectangular_ for more details, the available options and errors raised. Parameters: `other` - The other point (`LatLon`). `radius` - Optional, mean earth radius (`meter`) or `None` for the mean radius of this point's datum ellipsoid. `options` - Optional keyword arguments for function equirectangular. Returns: Distance (`meter`, same units as radius). Raises: `TypeError` - The other point is not `LatLon`.

### haversineTo(self, other, radius=None, wrap=False) |
Compute the distance between this and an other point using the Haversine formula. Parameters: `other` - The other point (`LatLon`). `radius` - Optional, mean earth radius (`meter`) or `None` for the mean radius of this point's datum ellipsoid. `wrap` - Wrap and unroll180 longitudes (`bool`). Returns: Distance (`meter`, same units as radius). Raises: `TypeError` - The other point is not `LatLon`. See Also: Function haversine, methods `equirectangularTo` and `distanceTo*`.

### isantipodeTo(self, other, eps=2.22044604925e-16) |
Check whether this and an other point are antipodal, on diametrically opposite sides of the earth. Parameters: `other` - The other point (`LatLon`). `eps` - Tolerance for near-equality (`degrees`). Returns: `True` if points are antipodal within the given tolerance, `False` otherwise.

### isequalTo(self, other, eps=None) |
Compare this point with an other point. Parameters: `other` - The other point (`LatLon`). `eps` - Tolerance for equality (`degrees`). Returns: `True` if both points are identical, ignoring height, `False` otherwise. Raises: `TypeError` - The other point is not `LatLon`. See Also: Method isequalTo3. Example:
    >>> p = LatLon(52.205, 0.119)
    >>> q = LatLon(52.205, 0.119)
    >>> e = p.isequalTo(q)  # True

### isequalTo3(self, other, eps=None) |
Compare this point with an other point. Parameters: `other` - The other point (`LatLon`). `eps` - Tolerance for equality (`degrees`). Returns: `True` if both points are identical including height, `False` otherwise. Raises: `TypeError` - The other point is not `LatLon`. See Also: Method isequalTo. Example:
    >>> p = LatLon(52.205, 0.119, 42)
    >>> q = LatLon(52.205, 0.119)
    >>> e = p.isequalTo3(q)  # False

### latlon2(self, ndigits=0) |
Return this point's lat- and longitude, rounded. Parameters: `ndigits` - Number of decimal digits (`int`). Returns: 2-Tuple (lat, lon) in (`degrees90`, `degrees180`), rounded away from zero. See Also: Built-in function `round`.

### points2(self, points, closed=True) |
Check a polygon represented by points. Parameters: `points` - The polygon points (`LatLon`[]) `closed` - Optionally, consider the polygon closed, ignoring any duplicate or closing final points (`bool`). Returns: 2-Tuple (number, ...) of points (`int`, `list` or `tuple`). Raises: `TypeError` - Some points are not `LatLon`. `ValueError` - Insufficient number of points.

### to2ab(self) |
Return this point's lat- and longitude in radians. Returns: 2-Tuple (lat, lon) in (`radiansPI_2`, `radiansPI`).

### to3llh(self) |
Return this point's lat-, longitude and height. Returns: 3-Tuple (lat, lon, h) in (`degrees90`, `degrees180`, `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` - Optional format, F_D, F_DM, F_DMS for deg°, deg°min′, deg°min′sec″ (`str`). `prec` - Optional number of decimal digits (0..8 or `None`). `m` - Optional unit of the height (`str`). `sep` - Optional separator to join (`str`). Returns: Point in the specified form (`str`). Overrides: _Based.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 (`degrees90`). Get Method: lat(self) - Get the latitude (`degrees90`). Set Method: lat(self, lat) - Set the latitude.

### latlon Get the lat- and longitude (2-tuple of `degrees90`, `degrees180`). Get Method: latlon(self) - Get the lat- and longitude (2-tuple of `degrees90`, `degrees180`). Set Method: latlon(self, latlonh) - Set the lat- and longitude and optionally the height.

### lon Get the longitude (`degrees180`). Get Method: lon(self) - Get the longitude (`degrees180`). Set Method: lon(self, lon) - Set the longitude.