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, end1, start2, end2, height=None, wrap=False) Locate the intersection point of two paths both defined by two points or a start point and bearing from North. |
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) DEPRECATED, use method sphericalTrigonometry.LatLon.nearestOn3. |
nearestOn3(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`, `boundsOf`, `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`), use raiser=`True` for behavior like `sphericalNvector.LatLon.initialBearingTo`. Returns: Initial bearing (compass `degrees360`). Raises: `CrossError` - If this and the other point coincide, provided raiser is `True` and crosserrors 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, end1, start2, end2, height=None, wrap=False) |
Locate the intersection point of two paths both defined by two points or a start point and bearing from North. Parameters: `end1` - End point of the first path (LatLon) or the initial bearing at this point (compass `degrees360`). `start2` - Start point of the second path (LatLon). `end2` - End point of the second path (LatLon) or the initial bearing at the second point (compass `degrees360`). `height` - Optional height for intersection point, overriding the mean height (`meter`). `wrap` - Wrap and unroll longitudes (`bool`). Returns: The intersection point (LatLon). An alternate intersection point might be the antipode to the returned result. Raises: `TypeError` - The start2, end1 or end2 is not LatLon. `ValueError` - Intersection is ambiguous or infinite or the paths are parallel, coincident or null. 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 (LatLon[]). 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_ and nearestOn5 and method sphericalTrigonometry.LatLon.nearestOn3.

### nearestOn2(self, points, closed=False, radius=6371008.77141, **options) |
DEPRECATED, use method sphericalTrigonometry.LatLon.nearestOn3. Returns: ... 2-Tuple (closest, distance) of the closest point (LatLon) on the polygon and the distance to that point ...

### nearestOn3(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 (LatLon[]). `closed` - Optionally, close the polygon (`bool`). `radius` - Optional, mean earth radius (`meter`). `options` - Optional keyword arguments for function equirectangular_. Returns: 3-Tuple (closest, distance, angle) of the closest point (LatLon) on the polygon, the distance and the compass angle to the closest point. The distance is the equirectangular_ distance between this and the closest point in `meter`, same units as radius. The angle from this to the closest point is in compass `degrees360`, like function compassAngle. 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 compassAngle, equirectangular_ and nearestOn5.

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