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

# Class LatLon

               object --+
                        |
              bases.Named --+
                            |
                  bases.Based --+
                                |
           bases.LatLonHeightBase --+
                                    |
    sphericalBase.LatLonSphericalBase --+
                                        |
                                       LatLon

New point on spherical model earth model.

Example:

    >>> p = LatLon(52.205, 0.119)  # height=0

Instance Methods
alongTrackDistanceTo(self, start, end, radius=6371008.77141, wrap=False) Compute the (signed) distance from the start to the closest point on the great circle path defined by a start and an end point. |
bearingTo(self, other, wrap=False, raiser=False) DEPRECATED, use method `initialBearingTo`. |
crossingParallels(self, other, lat, wrap=False) Return the pair of meridians at which a great circle defined by this and an other point crosses the given latitude. |
crossTrackDistanceTo(self, start, end, radius=6371008.77141, wrap=False) Compute the (signed) distance from this point to the great circle defined by a start and an end point. |
destination(self, distance, bearing, radius=6371008.77141, height=None) Locate the destination from this point after having travelled the given distance on the given initial bearing. |
distanceTo(self, other, radius=6371008.77141, wrap=False) Compute the distance from this to an other point. |
greatCircle(self, bearing) Compute the vector normal to great circle obtained by heading on the given initial bearing from this point. |
initialBearingTo(self, other, wrap=False, raiser=False) Compute the initial bearing (forward azimuth) from this to an other point. |
intermediateTo(self, other, fraction, height=None, wrap=False) Locate the point at given fraction between this and an other point. |
intersection(self, bearing, start2, bearing2, height=None, wrap=False) Locate the intersection of two paths each defined by a start point and an initial bearing. |
isenclosedBy(self, points) Check whether a (convex) polygon encloses this point. |
isEnclosedBy(self, points) DEPRECATED, use method `isenclosedBy`. |
midpointTo(self, other, height=None, wrap=False) Find the midpoint between this and an other point. |
nearestOn(self, point1, point2, radius=6371008.77141, **options) Locate the point between two points closest and this point. |
nearestOn2(self, points, closed=False, radius=6371008.77141, **options) Locate the point on a polygon closest to this point. |
toVector3d(self) Convert this point to a vector normal to earth's surface. |
Inherited from `sphericalBase.LatLonSphericalBase`: `bearingTo2`, `finalBearingTo`, `maxLat`, `minLat`, `parse`, `rhumbBearingTo`, `rhumbDestination`, `rhumbDistanceTo`, `rhumbMidpointTo`, `toWm` Inherited from `bases.LatLonHeightBase`: `__eq__`, `__init__`, `__ne__`, `__str__`, `antipode`, `bounds`, `compassAngle`, `compassAngleTo`, `copy`, `equals`, `equals3`, `equirectangularTo`, `haversineTo`, `isantipode`, `isantipodeTo`, `isequalTo`, `isequalTo3`, `latlon2`, `latlon2round`, `latlon_`, `points`, `points2`, `to2ab`, `to3llh`, `to3xyz`, `toStr` Inherited from `bases.Based`: `__repr__`, `classof`, `others`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
Inherited from `sphericalBase.LatLonSphericalBase`: `datum`, `isEllipsoidal`, `isSpherical` Inherited from `bases.LatLonHeightBase`: `height`, `lat`, `latlon`, `lon` Inherited from `bases.Named`: `classname`, `classnaming`, `name` Inherited from `object`: `__class__`

Method Details

### alongTrackDistanceTo(self, start, end, radius=6371008.77141, wrap=False) |
Compute the (signed) distance from the start to the closest point on the great circle path defined by a start and an end point. That is, if a perpendicular is drawn from this point to the great circle path, the along-track distance is the distance from the start point to the point where the perpendicular crosses the path. Parameters: `start` - Start point of great circle path (LatLon). `end` - End point of great circle path (LatLon). `radius` - Optional, mean earth radius (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: Distance along the great circle path (`meter`, same units as radius), positive if after the start toward the end point of the path or negative if before the start point. Raises: `TypeError` - The start or end point is not LatLon. Example:
    >>> p = LatLon(53.2611, -0.7972)
    >>> s = LatLon(53.3206, -1.7297)
    >>> e = LatLon(53.1887, 0.1334)
    >>> d = p.alongTrackDistanceTo(s, e)  # 62331.58

### crossingParallels(self, other, lat, wrap=False) |
Return the pair of meridians at which a great circle defined by this and an other point crosses the given latitude. Parameters: `other` - The other point defining great circle (LatLon). `lat` - Latitude at the crossing (`degrees`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: 2-Tuple (lon1, lon2) in (`degrees180`) or `None` if the great circle doesn't reach the given lat.

### crossTrackDistanceTo(self, start, end, radius=6371008.77141, wrap=False) |
Compute the (signed) distance from this point to the great circle defined by a start and an end point. Parameters: `start` - Start point of great circle path (LatLon). `end` - End point of great circle path (LatLon). `radius` - Optional, mean earth radius (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: Distance to great circle (negative if to the left or positive if to the right of the path). Raises: `TypeError` - The start or end point is not LatLon. Example:
    >>> p = LatLon(53.2611, -0.7972)
    >>> s = LatLon(53.3206, -1.7297)
    >>> e = LatLon(53.1887, 0.1334)
    >>> d = p.crossTrackDistanceTo(s, e)  # -307.5

### destination(self, distance, bearing, radius=6371008.77141, height=None) |
Locate the destination from this point after having travelled the given distance on the given initial 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 at destination (`meter`, same units a radius). Returns: Destination point (LatLon). Example:
    >>> p1 = LatLon(51.4778, -0.0015)
    >>> p2 = p1.destination(7794, 300.7)
    >>> p2.toStr()  # '51.5135°N, 000.0983°W'
JS name: destinationPoint.

### distanceTo(self, other, radius=6371008.77141, wrap=False) |
Compute the distance from this to an other point. Parameters: `other` - The other point (LatLon). `radius` - Optional, mean earth radius (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: Distance between this and the other point (`meter`, same units as radius). Raises: `TypeError` - The other point is not LatLon. Example:
    >>> p1 = LatLon(52.205, 0.119)
    >>> p2 = LatLon(48.857, 2.351);
    >>> d = p1.distanceTo(p2)  # 404300

### greatCircle(self, bearing) |
Compute the vector normal to great circle obtained by heading on the given initial bearing from this point. Direction of vector is such that initial bearing vector b = c × n, where n is an n-vector representing this point. Parameters: `bearing` - Bearing from this point (compass `degrees360`). Returns: Vector representing great circle (Vector3d). Example:
    >>> p = LatLon(53.3206, -1.7297)
    >>> g = p.greatCircle(96.0)
    >>> g.toStr()  # (-0.794, 0.129, 0.594)

### initialBearingTo(self, other, wrap=False, raiser=False) |
Compute the initial bearing (forward 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: Initial bearing (compass `degrees360`). Raises: `CrossError` - I this and the other point coincide, provided raiser is `True`. `TypeError` - The other point is not LatLon. Example:
    >>> p1 = LatLon(52.205, 0.119)
    >>> p2 = LatLon(48.857, 2.351)
    >>> b = p1.initialBearingTo(p2)  # 156.2
JS name: bearingTo.

### intermediateTo(self, other, fraction, height=None, wrap=False) |
Locate the point at given fraction between this and an other point. Parameters: `other` - The other point (LatLon). `fraction` - Fraction between both points (float, 0.0 = this point, 1.0 = the other point). `height` - Optional height, overriding the fractional height (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: Intermediate point (LatLon). Raises: `TypeError` - The other point is not LatLon. Example:
    >>> p1 = LatLon(52.205, 0.119)
    >>> p2 = LatLon(48.857, 2.351)
    >>> p = p1.intermediateTo(p2, 0.25)  # 51.3721°N, 000.7073°E
JS name: intermediatePointTo.

### intersection(self, bearing, start2, bearing2, height=None, wrap=False) |
Locate the intersection of two paths each defined by a start point and an initial bearing. Parameters: `bearing` - Initial bearing from this point (compass `degrees360`). `start2` - Start point of second path (LatLon). `bearing2` - Initial bearing from start2 (compass `degrees360`). `height` - Optional height for intersection point, overriding the mean height (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: Intersection point (LatLon). Raises: `TypeError` - Point start2 is not a LatLon. `ValueError` - Intersection is ambiguous or infinite or the paths are parallel or coincide. Example:
    >>> p = LatLon(51.8853, 0.2545)
    >>> s = LatLon(49.0034, 2.5735)
    >>> i = p.intersection(108.547, s, 32.435)  # '50.9078°N, 004.5084°E'

### isenclosedBy(self, points) |
Check whether a (convex) polygon encloses this point. Parameters: `points` - The polygon points (LatLons). Returns: `True` if the polygon encloses this point, `False` otherwise. Raises: `ValueError` - Insufficient number of points or non-convex polygon. `TypeError` - Some points are not LatLon. Example:
    >>> b = LatLon(45,1), LatLon(45,2), LatLon(46,2), LatLon(46,1)
    >>> p = LatLon(45,1, 1.1)
    >>> inside = p.isEnclosedBy(b)  # True

### midpointTo(self, other, height=None, wrap=False) |
Find the midpoint between this and an other point. Parameters: `other` - The other point (LatLon). `height` - Optional height for midpoint, overriding the mean height (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: Midpoint (LatLon). Raises: `TypeError` - The other point is not LatLon. Example:
    >>> p1 = LatLon(52.205, 0.119)
    >>> p2 = LatLon(48.857, 2.351)
    >>> m = p1.midpointTo(p2)  # '50.5363°N, 001.2746°E'

### nearestOn(self, point1, point2, radius=6371008.77141, **options) |
Locate the point between two points closest and this point. Distances are approximated by function equirectangular_, subject to the supplied options. Parameters: `point1` - Start point (LatLon). `point2` - End point (LatLon). `radius` - Optional, mean earth radius (`meter`). `options` - Optional keyword arguments for function equirectangular_. Returns: Closest point on the arc (LatLon). Raises: `LimitError` - Lat- and/or longitudinal delta exceeds limit, see function equirectangular_. `TypeError` - If point1 or point2 is not LatLon. See Also: Functions equirectangular_, nearestOn3 and sphericalTrigonometry.nearestOn2.

### nearestOn2(self, points, closed=False, radius=6371008.77141, **options) |
Locate the point on a polygon closest to this point. Distances are approximated by function equirectangular_, subject to the supplied options. Parameters: `points` - The polygon points (LatLons). `closed` - Optionally, close the polygon (`bool`). `radius` - Optional, mean earth radius (`meter`). `options` - Optional keyword arguments for function equirectangular_. Returns: 2-Tuple (closest, distance) of the closest point (LatLon) on the polygon and the distance to that point. The distance is the equirectangular_ distance between this and the closest point in `meter`, same units as radius. Raises: `LimitError` - Lat- and/or longitudinal delta exceeds limit, see function equirectangular_. `TypeError` - Some points are not `LatLon`. `ValueError` - Insufficient number of points. See Also: Functions equirectangular_, nearestOn3 and sphericalTrigonometry.nearestOn2.

### toVector3d(self) |
Convert this point to a vector normal to earth's surface. Returns: Vector representing this point (Vector3d).