Package pygeodesy3 :: Package distances
[frames] | no frames]

Package distances

Classes and functions to compute various distances.


Version: 23.12.18

Submodules

Classes
  Collins5Tuple
5-Tuple (pointP, pointH, a, b, c) with survey pointP, auxiliary pointH, each an instance of pointA's (sub-)class and triangle sides a, b and c in meter, conventionally.
  Frechet
Frechet base class, requires method Frechet.distance to be overloaded.
  Frechet6Tuple
6-Tuple (fd, fi1, fi2, r, n, units) with the discrete Fréchet distance fd, fractional indices fi1 and fi2 as FIx, the recursion depth r, the number of distances computed n and the units class or class or name of the distance units.
  FrechetCosineAndoyerLambert
Compute the Frechet distance based on the angular distance in radians from function pygeodesy3.cosineAndoyerLambert.
  FrechetCosineForsytheAndoyerLambert
Compute the Frechet distance based on the angular distance in radians from function pygeodesy3.cosineForsytheAndoyerLambert.
  FrechetCosineLaw
Compute the Frechet distance based on the angular distance in radians from function pygeodesy3.cosineLaw.
  FrechetDegrees
DEPRECATED, use an other Frechet* class.
  FrechetDistanceTo
Compute the Frechet distance based on the distance from the point1s' LatLon.distanceTo method, conventionally in meter.
  FrechetEquirectangular
Compute the Frechet distance based on the equirectangular distance in radians squared like function pygeodesy3.equirectangular.
  FrechetError
Fréchet issue.
  FrechetEuclidean
Compute the Frechet distance based on the Euclidean distance in radians from function pygeodesy3.euclidean.
  FrechetExact
Compute the Frechet distance based on the angular distance in degrees from method GeodesicExact.Inverse.
  FrechetFlatLocal
Compute the Frechet distance based on the angular distance in radians squared like function pygeodesy3.flatLocal_/pygeodesy3.hubeny.
  FrechetFlatPolar
Compute the Frechet distance based on the angular distance in radians from function flatPolar_.
  FrechetHaversine
Compute the Frechet distance based on the angular distance in radians from function pygeodesy3.haversine_.
  FrechetHubeny
Compute the Frechet distance based on the angular distance in radians squared like function pygeodesy3.flatLocal_/pygeodesy3.hubeny.
  FrechetKarney
Compute the Frechet distance based on the angular distance in degrees from Karney's geographiclib geodesic.Geodesic Inverse method.
  FrechetRadians
DEPRECATED, use an other Frechet* class.
  FrechetThomas
Compute the Frechet distance based on the angular distance in radians from function pygeodesy3.thomas_.
  FrechetVincentys
Compute the Frechet distance based on the angular distance in radians from function pygeodesy3.vincentys_.
  Hausdorff
Hausdorff base class, requires method Hausdorff.distance to be overloaded.
  Hausdorff6Tuple
6-Tuple (hd, i, j, mn, md, units) with the Hausdorff distance hd, indices i and j, the total count mn, the mean Hausdorff distance md and the class or name of both distance units.
  HausdorffCosineAndoyerLambert
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.cosineAndoyerLambert.
  HausdorffCosineForsytheAndoyerLambert
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.cosineForsytheAndoyerLambert.
  HausdorffCosineLaw
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.cosineLaw_.
  HausdorffDegrees
Hausdorff base class for distances from LatLon points in degrees.
  HausdorffDistanceTo
Compute the Hausdorff distance based on the distance from the points' LatLon.distanceTo method, conventionally in meter.
  HausdorffEquirectangular
Compute the Hausdorff distance based on the equirectangular distance in radians squared like function pygeodesy3.equirectangular_.
  HausdorffError
Hausdorff issue.
  HausdorffEuclidean
Compute the Hausdorff distance based on the Euclidean distance in radians from function pygeodesy3.euclidean_.
  HausdorffExact
Compute the Hausdorff distance based on the angular distance in degrees from method GeodesicExact.Inverse.
  HausdorffFlatLocal
Compute the Hausdorff distance based on the angular distance in radians squared like function pygeodesy3.flatLocal_/pygeodesy3.hubeny_.
  HausdorffFlatPolar
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.flatPolar_.
  HausdorffHaversine
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.haversine_.
  HausdorffHubeny
Compute the Hausdorff distance based on the angular distance in radians squared like function pygeodesy3.flatLocal_/pygeodesy3.hubeny_.
  HausdorffKarney
Compute the Hausdorff distance based on the angular distance in degrees from Karney's geographiclib Geodesic Inverse method.
  HausdorffRadians
Hausdorff base class for distances from LatLon points converted from degrees to radians.
  HausdorffThomas
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.thomas_.
  HausdorffVincentys
Compute the Hausdorff distance based on the angular distance in radians from function pygeodesy3.vincentys_.
  Radical2Tuple
2-Tuple (ratio, xline) of the radical ratio and radical xline, both scalar and 0.0 <= ratio <= 1.0
  ResectionError
Error raised for pygeodesy3.distances.resections issues.
  Survey3Tuple
3-Tuple (PA, PB, PC) with distance from survey point P to each of the triangle corners A, B and C in meter, conventionally.
  Tienstra7Tuple
7-Tuple (pointP, A, B, C, a, b, c) with survey pointP, interior triangle angles A, B and C in degrees and triangle sides a, b and c in meter, conventionally.
  TriAngle5Tuple
5-Tuple (radA, radB, radC, rIn, area) with the interior angles at triangle corners A, B and C in radians, the InCircle radius rIn aka inradius in meter and the triangle area in meter squared, conventionally.
  TriSide2Tuple
2-Tuple (a, radA) with triangle side a in meter, conventionally and angle radA at the opposite triangle corner in radians.
  TriSide4Tuple
4-Tuple (a, b, radC, d) with interior angle radC at triangle corner C in radianswith the length of triangle sides a and b and with triangle height d perpendicular to triangle side c, in the same units as triangle sides a and b.
Functions
 
antipode(lat, lon, name='')
Return the antipode, the point diametrically opposite to a given point in degrees.
 
antipode_(phi, lam, name='')
Return the antipode, the point diametrically opposite to a given point in radians.
 
bearing(lat1, lon1, lat2, lon2, **final_wrap)
Compute the initial or final bearing (forward or reverse azimuth) between a (spherical) start and end point.
 
bearing_(phi1, lam1, phi2, lam2, final=False, wrap=False)
Compute the initial or final bearing (forward or reverse azimuth) between a (spherical) start and end point.
 
cassini(pointA, pointB, pointC, alpha, beta, useZ=False, Clas=None, **Clas_kwds)
3-Point resection using Cassini's method.
 
collins5(pointA, pointB, pointC, alpha, beta, useZ=False, Clas=None, **Clas_kwds)
3-Point resection using Collins' method.
 
compassAngle(lat1, lon1, lat2, lon2, adjust=True, wrap=False)
Return the angle from North for the direction vector (lon2 - lon1, lat2 - lat1) between two points.
 
cosineAndoyerLambert(lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., wrap=False)
Compute the distance between two (ellipsoidal) points using the Andoyer-Lambert correction of the Law of Cosines formula.
 
cosineAndoyerLambert_(phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)
Compute the angular distance between two (ellipsoidal) points using the Andoyer-Lambert correction of the Law of Cosines formula.
 
cosineForsytheAndoyerLambert(lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., wrap=False)
Compute the distance between two (ellipsoidal) points using the Forsythe-Andoyer-Lambert correction of the Law of Cosines formula.
 
cosineForsytheAndoyerLambert_(phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)
Compute the angular distance between two (ellipsoidal) points using the Forsythe-Andoyer-Lambert correction of the Law of Cosines formula.
 
cosineLaw(lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)
Compute the distance between two points using the spherical Law of Cosines formula.
 
cosineLaw_(phi2, phi1, lam21)
Compute the angular distance between two points using the spherical Law of Cosines formula.
 
equirectangular(lat1, lon1, lat2, lon2, radius=6371008.771415, **adjust_limit_wrap)
Compute the distance between two points using the Equirectangular Approximation / Projection.
 
equirectangular_(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False)
Compute the distance between two points using the Equirectangular Approximation / Projection.
 
euclidean(lat1, lon1, lat2, lon2, radius=6371008.771415, adjust=True, wrap=False)
Approximate the Euclidean distance between two (spherical) points.
 
euclidean_(phi2, phi1, lam21, adjust=True)
Approximate the angular Euclidean distance between two (spherical) points.
 
excessAbc_(A, b, c)
Compute the spherical excess E of a (spherical) triangle from two sides and the included (small) angle.
 
excessCagnoli_(a, b, c)
Compute the spherical excess E of a (spherical) triangle using Cagnoli's (D.34) formula.
 
excessGirard_(A, B, C)
Compute the spherical excess E of a (spherical) triangle using Girard's formula.
 
excessKarney(lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)
Compute the surface area of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator using Karney's method.
 
excessKarney_(phi2, phi1, lam21)
Compute the spherical excess E of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator using Karney's method.
 
excessLHuilier_(a, b, c)
Compute the spherical excess E of a (spherical) triangle using L'Huilier's's Theorem.
 
excessQuad(lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)
Compute the surface area of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator.
 
excessQuad_(phi2, phi1, lam21)
Compute the spherical excess E of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator.
 
flatLocal(lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True, wrap=False)
Compute the distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.
 
flatLocal_(phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True)
Compute the angular distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.
 
flatPolar(lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)
Compute the distance between two (spherical) points using the polar coordinate flat-Earth formula.
 
flatPolar_(phi2, phi1, lam21)
Compute the angular distance between two (spherical) points using the polar coordinate flat-Earth formula.
 
frechet_(point1s, point2s, distance=None, units='')
Compute the discrete Fréchet distance between two paths, each given as a set of points.
 
hartzell(pov, los=True, earth=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., name='', **LatLon_and_kwds)
Compute the intersection of the earth's surface and a Line-Of-Sight from a Point-Of-View in space.
 
hausdorff_(model, target, both=False, early=True, seed=None, units='', distance=None, point=<function _point at 0x7fd2088b4dd0>)
Compute the directed or symmetric Hausdorff distance between 2 sets of points with or without early breaking and random sampling.
 
haversine(lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)
Compute the distance between two (spherical) points using the Haversine formula.
 
haversine_(phi2, phi1, lam21)
Compute the angular distance between two (spherical) points using the Haversine formula.
 
heightOf(angle, distance, radius=6371008.771415)
Determine the height above the (spherical) earth' surface after traveling along a straight line at a given tilt.
 
heightOrthometric(h_ll, N)
Get the orthometric height H, the height above the geoid, earth surface.
 
horizon(height, radius=6371008.771415, refraction=False)
Determine the distance to the horizon from a given altitude above the (spherical) earth.
 
hubeny(lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True, wrap=False)
Compute the distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.
 
hubeny_(phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True)
Compute the angular distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.
 
intersection2(lat1, lon1, bearing1, lat2, lon2, bearing2, datum=None, wrap=False, small=100000.0)
Conveniently compute the intersection of two lines each defined by a (geodetic) point and a bearing from North, using either ...
 
intersections2(lat1, lon1, radius1, lat2, lon2, radius2, datum=None, wrap=False, small=100000.0)
Conveniently compute the intersections of two circles each defined by a (geodetic) center point and a radius, using either ...
 
isantipode(lat1, lon1, lat2, lon2, eps=2.220446049250313e-16)
Check whether two points are antipodal, on diametrically opposite sides of the earth.
 
isantipode_(phi1, lam1, phi2, lam2, eps=2.220446049250313e-16)
Check whether two points are antipodal, on diametrically opposite sides of the earth.
 
isnormal(lat, lon, eps=0)
Check whether lat and lon are within their respective normal range in degrees.
 
isnormal_(phi, lam, eps=0)
Check whether phi and lam are within their respective normal range in radians.
 
latlon2n_xyz(lat, lon, name='')
Convert lat-, longitude to n-vector (normal to the earth's surface) X, Y and Z components.
 
n_xyz2latlon(x, y, z, name='')
Convert n-vector components to lat- and longitude in degrees.
 
n_xyz2philam(x, y, z, name='')
Convert n-vector components to lat- and longitude in radians.
 
normal(lat, lon, name='')
Normalize a lat- and longitude pair in degrees.
 
normal_(phi, lam, name='')
Normalize a lat- and longitude pair in radians.
 
opposing(bearing1, bearing2, margin=90.0)
Compare the direction of two bearings given in degrees.
 
opposing_(radians1, radians2, margin=1.5707963267948966)
Compare the direction of two bearings given in radians.
 
philam2n_xyz(phi, lam, name='')
Convert lat-, longitude to n-vector (normal to the earth's surface) X, Y and Z components.
 
pierlot(point1, point2, point3, alpha12, alpha23, useZ=False, eps=2.220446049250313e-16, Clas=None, **Clas_kwds)
3-Point resection using Pierlot's method ToTal with approximate limits for the (pseudo-)singularities.
 
pierlotx(point1, point2, point3, alpha1, alpha2, alpha3, useZ=False, Clas=None, **Clas_kwds)
3-Point resection using Pierlot's method ToTal with exact limits for the (pseudo-)singularities.
 
radical2(distance, radius1, radius2)
Compute the radical ratio and radical line of two intersecting circles.
 
randomrangenerator(seed)
Return a seeded random range function generator.
 
snellius3(a, b, degC, alpha, beta)
Snellius' surveying using Snellius Pothenot.
 
thomas(lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., wrap=False)
Compute the distance between two (ellipsoidal) points using Thomas' formula.
 
thomas_(phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)
Compute the angular distance between two (ellipsoidal) points using Thomas' formula.
 
tienstra7(pointA, pointB, pointC, alpha, beta=None, gamma=None, useZ=False, Clas=None, **Clas_kwds)
3-Point resection using Tienstra's formula.
 
triAngle(a, b, c)
Compute one angle of a triangle.
 
triAngle5(a, b, c)
Compute the angles of a triangle.
 
triArea(a, b, c)
Compute the area of a triangle using Heron's stable formula.
 
triSide(a, b, radC)
Compute one side of a triangle.
 
triSide2(b, c, radB)
Compute a side and its opposite angle of a triangle.
 
triSide4(radA, radB, c)
Compute two sides and the height of a triangle.
 
vincentys(lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)
Compute the distance between two (spherical) points using Vincenty's spherical formula.
 
vincentys_(phi2, phi1, lam21)
Compute the angular distance between two (spherical) points using Vincenty's spherical formula.
 
wildberger3(a, b, c, alpha, beta, R3=<built-in function min>)
Snellius' surveying using Rational Trigonometry.
Variables
  __getattr__ = _lazy_import_as(__name__)
Function Details

antipode (lat, lon, name='')

 

Return the antipode, the point diametrically opposite to a given point in degrees.

Arguments:
  • lat - Latitude (degrees).
  • lon - Longitude (degrees).
  • name - Optional name (str).
Returns:
A LatLon2Tuple(lat, lon).

See Also: Functions antipode_ and normal and Geosphere.

antipode_ (phi, lam, name='')

 

Return the antipode, the point diametrically opposite to a given point in radians.

Arguments:
  • phi - Latitude (radians).
  • lam - Longitude (radians).
  • name - Optional name (str).
Returns:
A PhiLam2Tuple(phi, lam).

See Also: Functions antipode and normal_ and Geosphere.

bearing (lat1, lon1, lat2, lon2, **final_wrap)

 

Compute the initial or final bearing (forward or reverse azimuth) between a (spherical) start and end point.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • final_wrap - Optional keyword arguments for function pygeodesy3.bearing_.
Returns:
Initial or final bearing (compass degrees360) or zero if start and end point coincide.

bearing_ (phi1, lam1, phi2, lam2, final=False, wrap=False)

 

Compute the initial or final bearing (forward or reverse azimuth) between a (spherical) start and end point.

Arguments:
  • phi1 - Start latitude (radians).
  • lam1 - Start longitude (radians).
  • phi2 - End latitude (radians).
  • lam2 - End longitude (radians).
  • final - Return final bearing if True, initial otherwise (bool).
  • wrap - If True, wrap or normalize and unroll phi2 and lam2 (bool).
Returns:
Initial or final bearing (compass radiansPI2) or zero if start and end point coincide.

cassini (pointA, pointB, pointC, alpha, beta, useZ=False, Clas=None, **Clas_kwds)

 

3-Point resection using Cassini's method.

Arguments:
  • pointA - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • pointB - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • pointC - Center point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • alpha - Angle subtended by triangle side pointA to pointC (degrees, non-negative).
  • beta - Angle subtended by triangle side pointB to pointC (degrees, non-negative).
  • useZ - If True, use and interpolate the Z component, otherwise force z=INT0 (bool).
  • Clas - Optional class to return the survey point or None for pointA's (sub-)class.
  • Clas_kwds - Optional, additional keyword argument for the survey point instance.
Returns:
The survey point, an instance of Clas or if Clas is None an instance of pointA's (sub-)class.
Raises:
  • ResectionError - Near-coincident, -colinear or -concyclic points or negative or invalid alpha or beta.
  • TypeError - Invalid pointA, pointB or pointM.

Note: Typically, pointC is between pointA and pointB.

See Also: Three Point Resection Problem and functions pygeodesy3.collins5, pygeodesy3.pierlot and pygeodesy3.tienstra7.

collins5 (pointA, pointB, pointC, alpha, beta, useZ=False, Clas=None, **Clas_kwds)

 

3-Point resection using Collins' method.

Arguments:
  • pointA - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • pointB - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • pointC - Center point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • alpha - Angle subtended by triangle side b from pointA to pointC (degrees, non-negative).
  • beta - Angle subtended by triangle side a from pointB to pointC (degrees, non-negative).
  • useZ - If True, use and interpolate the Z component, otherwise force z=INT0 (bool).
  • Clas - Optional class to return the survey and auxiliary point or None for pointA's (sub-)class.
  • Clas_kwds - Optional, additional keyword argument for the survey and auxiliary point instance.
Returns:
Collins5Tuple(pointP, pointH, a, b, c) with survey pointP, auxiliary pointH, each an instance of Clas or if Clas is None an instance of pointA's (sub-)class and triangle sides a, b and c in meter, conventionally.
Raises:
  • ResectionError - Near-coincident, -colinear or -concyclic points or negative or invalid alpha or beta.
  • TypeError - Invalid pointA, pointB or pointM.

Note: Typically, pointC is between pointA and pointB.

See Also: Collins' methode and functions pygeodesy3.cassini, pygeodesy3.pierlot and pygeodesy3.tienstra7.

compassAngle (lat1, lon1, lat2, lon2, adjust=True, wrap=False)

 

Return the angle from North for the direction vector (lon2 - lon1, lat2 - lat1) between two points.

Suitable only for short, not near-polar vectors up to a few hundred Km or Miles. Use function pygeodesy3.bearing for longer vectors.

Arguments:
  • lat1 - From latitude (degrees).
  • lon1 - From longitude (degrees).
  • lat2 - To latitude (degrees).
  • lon2 - To longitude (degrees).
  • adjust - Adjust the longitudinal delta by the cosine of the mean latitude (bool).
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Compass angle from North (degrees360).

Note: Courtesy of Martin Schultz.

See Also: Local, flat earth approximation.

cosineAndoyerLambert (lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., wrap=False)

 

Compute the distance between two (ellipsoidal) points using the Andoyer-Lambert correction of the Law of Cosines formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • datum - Datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as the datum's ellipsoid axes or radians if datum is None).
Raises:
  • TypeError - Invalid datum.

cosineAndoyerLambert_ (phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)

 

Compute the angular distance between two (ellipsoidal) points using the Andoyer-Lambert correction of the Law of Cosines formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
  • datum - Datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
Returns:
Angular distance (radians).
Raises:
  • TypeError - Invalid datum.

cosineForsytheAndoyerLambert (lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., wrap=False)

 

Compute the distance between two (ellipsoidal) points using the Forsythe-Andoyer-Lambert correction of the Law of Cosines formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • datum - Datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as the datum's ellipsoid axes or radians if datum is None).
Raises:
  • TypeError - Invalid datum.

cosineForsytheAndoyerLambert_ (phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)

 

Compute the angular distance between two (ellipsoidal) points using the Forsythe-Andoyer-Lambert correction of the Law of Cosines formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
  • datum - Datum (Datum) or ellipsoid to use (Ellipsoid, Ellipsoid2 or a_f2Tuple).
Returns:
Angular distance (radians).
Raises:
  • TypeError - Invalid datum.

cosineLaw (lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)

 

Compute the distance between two points using the spherical Law of Cosines formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and lat2 and lon2 (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - Invalid radius.

cosineLaw_ (phi2, phi1, lam21)

 

Compute the angular distance between two points using the spherical Law of Cosines formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
Returns:
Angular distance (radians).

equirectangular (lat1, lon1, lat2, lon2, radius=6371008.771415, **adjust_limit_wrap)

 

Compute the distance between two points using the Equirectangular Approximation / Projection.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple).
  • adjust_limit_wrap - Optional keyword arguments for function equirectangular_.
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - Invalid radius.

See Also: Function equirectangular_ for more details, the available options, errors, restrictions and other, approximate or accurate distance functions.

equirectangular_ (lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False)

 

Compute the distance between two points using the Equirectangular Approximation / Projection.

This approximation is valid for short distance of several hundred Km or Miles, see the limit keyword argument and LimitError.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • adjust - Adjust the wrapped, unrolled longitudinal delta by the cosine of the mean latitude (bool).
  • limit - Optional limit for lat- and longitudinal deltas (degrees) or None or 0 for unlimited.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
A Distance4Tuple(distance2, delta_lat, delta_lon, unroll_lon2) in degrees squared.
Raises:

euclidean (lat1, lon1, lat2, lon2, radius=6371008.771415, adjust=True, wrap=False)

 

Approximate the Euclidean distance between two (spherical) points.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • adjust - Adjust the longitudinal delta by the cosine of the mean latitude (bool).
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - Invalid radius.

euclidean_ (phi2, phi1, lam21, adjust=True)

 

Approximate the angular Euclidean distance between two (spherical) points.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
  • adjust - Adjust the longitudinal delta by the cosine of the mean latitude (bool).
Returns:
Angular distance (radians).

excessAbc_ (A, b, c)

 

Compute the spherical excess E of a (spherical) triangle from two sides and the included (small) angle.

Arguments:
  • A - An interior triangle angle (radians).
  • b - Frist adjacent triangle side (radians).
  • c - Second adjacent triangle side (radians).
Returns:
Spherical excess (radians).
Raises:

excessCagnoli_ (a, b, c)

 

Compute the spherical excess E of a (spherical) triangle using Cagnoli's (D.34) formula.

Arguments:
  • a - First triangle side (radians).
  • b - Second triangle side (radians).
  • c - Third triangle side (radians).
Returns:
Spherical excess (radians).
Raises:

See Also: Function excessLHuilier_ and Spherical trigonometry.

excessGirard_ (A, B, C)

 

Compute the spherical excess E of a (spherical) triangle using Girard's formula.

Arguments:
  • A - First interior triangle angle (radians).
  • B - Second interior triangle angle (radians).
  • C - Third interior triangle angle (radians).
Returns:
Spherical excess (radians).
Raises:

See Also: Function excessLHuilier_ and Spherical trigonometry.

excessKarney (lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)

 

Compute the surface area of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator using Karney's method.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) or None.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Surface area, signed (square meter or the same units as radius squared) or the spherical excess (radians) if radius=0 or None.
Raises:
  • TypeError - Invalid radius.
  • UnitError - Invalid lat2 or lat1.
  • ValueError - Semi-circular longitudinal delta.

See Also: Functions excessKarney_ and excessQuad.

excessKarney_ (phi2, phi1, lam21)

 

Compute the spherical excess E of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator using Karney's method.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
Returns:
Spherical excess, signed (radians).
Raises:
  • ValueError - Semi-circular longitudinal delta lam21.

See Also: Function excessKarney and Area of a spherical polygon.

excessLHuilier_ (a, b, c)

 

Compute the spherical excess E of a (spherical) triangle using L'Huilier's's Theorem.

Arguments:
  • a - First triangle side (radians).
  • b - Second triangle side (radians).
  • c - Third triangle side (radians).
Returns:
Spherical excess (radians).
Raises:

excessQuad (lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)

 

Compute the surface area of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) or None.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Surface area, signed (square meter or the same units as radius squared) or the spherical excess (radians) if radius=0 or None.
Raises:
  • TypeError - Invalid radius.
  • UnitError - Invalid lat2 or lat1.

See Also: Function excessQuad_ and excessKarney.

excessQuad_ (phi2, phi1, lam21)

 

Compute the spherical excess E of a (spherical) quadrilateral bounded by a segment of a great circle, two meridians and the equator.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
Returns:
Spherical excess, signed (radians).

See Also: Function excessQuad and Spherical trigonometry.

flatLocal (lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True, wrap=False)

 

Compute the distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • datum - Datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • scaled - Scale prime_vertical by cos(phi) (bool), see method pygeodesy3.Ellipsoid.roc2_.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as the datum's ellipsoid axes).
Raises:
  • TypeError - Invalid datum.

Note: The meridional and prime_vertical radii of curvature are taken and scaled at the mean of both latitude.

See Also: Functions flatLocal_ or hubeny_, cosineLaw, flatPolar, cosineAndoyerLambert, cosineForsytheAndoyerLambert, equirectangular, euclidean, haversine, thomas, vincentys, method Ellipsoid.distance2 and local, flat earth approximation.

flatLocal_ (phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True)

 

Compute the angular distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.

Arguments:
Returns:
Angular distance (radians).
Raises:
  • TypeError - Invalid datum.

Note: The meridional and prime_vertical radii of curvature are taken and scaled at the mean of both latitude.

See Also: Functions flatLocal or hubeny, cosineAndoyerLambert_, cosineForsytheAndoyerLambert_, cosineLaw_, flatPolar_, equirectangular_, euclidean_, haversine_, thomas_ and vincentys_ and local, flat earth approximation.

flatPolar (lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)

 

Compute the distance between two (spherical) points using the polar coordinate flat-Earth formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and lat2 and lon2 (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - Invalid radius.

flatPolar_ (phi2, phi1, lam21)

 

Compute the angular distance between two (spherical) points using the polar coordinate flat-Earth formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
Returns:
Angular distance (radians).

frechet_ (point1s, point2s, distance=None, units='')

 

Compute the discrete Fréchet distance between two paths, each given as a set of points.

Arguments:
  • point1s - First set of points (LatLon[], Numpy2LatLon[], Tuple2LatLon[] or other[]).
  • point2s - Second set of points (LatLon[], Numpy2LatLon[], Tuple2LatLon[] or other[]).
  • distance - Callable returning the distance between a point1s and a point2s point (signature (point1, point2)).
  • units - Optional, the distance units (Unit or str).
Returns:
A Frechet6Tuple(fd, fi1, fi2, r, n, units) where fi1 and fi2 are type int indices into point1s respectively point2s.
Raises:

Note: Function frechet_ does not support fractional indices for intermediate point1s and point2s.

hartzell (pov, los=True, earth=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., name='', **LatLon_and_kwds)

 

Compute the intersection of the earth's surface and a Line-Of-Sight from a Point-Of-View in space.

Arguments:
  • pov - Point-Of-View outside the earth (LatLon, Cartesian, Ecef9Tuple or Vector3d).
  • los - Line-Of-Sight, direction to earth (Los, Vector3d), True for the normal, plumb onto the surface or False or None to point to the center of the earth.
  • earth - The earth model (Datum, Ellipsoid, Ellipsoid2, a_f2Tuple or a scalar earth radius in meter).
  • name - Optional name (str).
  • LatLon_and_kwds - Optional LatLon=None class to return the intersection plus additional LatLon keyword arguments, include datum if different from earth.
Returns:
The intersection (Vector3d, pov's cartesian type or the given LatLon instance) with attribute heigth set to the distance to the pov.
Raises:
  • IntersectionError - Invalid pov or pov inside the earth or invalid los or los points outside or away from the earth.
  • TypeError - Invalid earth or datum.

See Also: Class Los, functions tyr3d and hartzell4 and methods Ellipsoid.hartzell4 and any Cartesian.hartzell and LatLon.hartzell.

hausdorff_ (model, target, both=False, early=True, seed=None, units='', distance=None, point=<function _point at 0x7fd2088b4dd0>)

 

Compute the directed or symmetric Hausdorff distance between 2 sets of points with or without early breaking and random sampling.

Arguments:
  • model - First set of points (LatLon[], Numpy2LatLon[], Tuple2LatLon[] or other[]).
  • target - Second set of points (LatLon[], Numpy2LatLon[], Tuple2LatLon[] or other[]).
  • both - Return the directed (forward only) or the symmetric (combined forward and reverse) Hausdorff distance (bool).
  • early - Enable or disable early breaking (bool).
  • seed - Random sampling seed (any) or None, 0 or False for no random sampling.
  • units - Optional, the distance units (Unit or str).
  • distance - Callable returning the distance between a model and target point (signature (point1, point2)).
  • point - Callable returning the model or target point suitable for distance (signature (point)).
Returns:
A Hausdorff6Tuple(hd, i, j, mn, md, units).
Raises:
  • HausdorffError - Insufficient number of model or target points.
  • TypeError - If distance or point is not callable.

haversine (lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)

 

Compute the distance between two (spherical) points using the Haversine formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as radius).
Raises:
  • TypeError - Invalid radius.

See Also: Distance between two (spherical) points, functions cosineLaw, cosineAndoyerLambert, cosineForsytheAndoyerLambert, equirectangular, euclidean, flatLocal/hubeny, flatPolar, thomas and vincentys and methods Ellipsoid.distance2, LatLon.distanceTo* and LatLon.equirectangularTo.

Note: See note at function vincentys_.

haversine_ (phi2, phi1, lam21)

 

Compute the angular distance between two (spherical) points using the Haversine formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
Returns:
Angular distance (radians).

heightOf (angle, distance, radius=6371008.771415)

 

Determine the height above the (spherical) earth' surface after traveling along a straight line at a given tilt.

Arguments:
  • angle - Tilt angle above horizontal (degrees).
  • distance - Distance along the line (meter or same units as radius).
  • radius - Optional mean earth radius (meter).
Returns:
Height (meter, same units as distance and radius).
Raises:
  • ValueError - Invalid angle, distance or radius.

heightOrthometric (h_ll, N)

 

Get the orthometric height H, the height above the geoid, earth surface.

Arguments:
  • h_ll - The height above the ellipsoid (meter) or an ellipsoidal location (LatLon with a height or h attribute).
  • N - The geoid height (meter), the height of the geoid above the ellipsoid at the same h_ll location.
Returns:
Orthometric height H = h - N (meter, same units as h and N).

See Also: Ellipsoid, Geoid, and Othometric Heights, page 6 and module geoids.

horizon (height, radius=6371008.771415, refraction=False)

 

Determine the distance to the horizon from a given altitude above the (spherical) earth.

Arguments:
  • height - Altitude (meter or same units as radius).
  • radius - Optional mean earth radius (meter).
  • refraction - Consider atmospheric refraction (bool).
Returns:
Distance (meter, same units as height and radius).
Raises:
  • ValueError - Invalid height or radius.

See Also: Distance to horizon.

hubeny (lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True, wrap=False)

 

Compute the distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • datum - Datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • scaled - Scale prime_vertical by cos(phi) (bool), see method pygeodesy3.Ellipsoid.roc2_.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as the datum's ellipsoid axes).
Raises:
  • TypeError - Invalid datum.

Note: The meridional and prime_vertical radii of curvature are taken and scaled at the mean of both latitude.

See Also: Functions flatLocal_ or hubeny_, cosineLaw, flatPolar, cosineAndoyerLambert, cosineForsytheAndoyerLambert, equirectangular, euclidean, haversine, thomas, vincentys, method Ellipsoid.distance2 and local, flat earth approximation.

hubeny_ (phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., scaled=True)

 

Compute the angular distance between two (ellipsoidal) points using the ellipsoidal Earth to plane projection aka Hubeny formula.

Arguments:
Returns:
Angular distance (radians).
Raises:
  • TypeError - Invalid datum.

Note: The meridional and prime_vertical radii of curvature are taken and scaled at the mean of both latitude.

See Also: Functions flatLocal or hubeny, cosineAndoyerLambert_, cosineForsytheAndoyerLambert_, cosineLaw_, flatPolar_, equirectangular_, euclidean_, haversine_, thomas_ and vincentys_ and local, flat earth approximation.

intersection2 (lat1, lon1, bearing1, lat2, lon2, bearing2, datum=None, wrap=False, small=100000.0)

 

Conveniently compute the intersection of two lines each defined by a (geodetic) point and a bearing from North, using either ...

1) vector3d.intersection3d3 for small distances (below 100 Km or about 0.88 degrees) or if no datum is specified, or ...

2) spherical.trigonometry.intersection for a spherical datum or a scalar datum representing the earth radius, conventionally in meter or ...

3) spherical.nvector.intersection if datum is a negative scalar, (negative) earth radius, conventionally in meter or ...

4) ellipsoidal.karney.intersection3 for an ellipsoidal datum and if Karney's geographiclib is installed, otherwise ...

5) ellipsoidal.exact.intersection3, provided datum is ellipsoidal.

Arguments:
  • lat1 - Latitude of the first point (degrees).
  • lon1 - Longitude of the first point (degrees).
  • bearing1 - Bearing at the first point (compass degrees).
  • lat2 - Latitude of the second point (degrees).
  • lon2 - Longitude of the second point (degrees).
  • bearing2 - Bearing at the second point (compass degrees).
  • datum - Optional datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) or scalar earth radius (meter, same units as radius1 and radius2) or None.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
  • small - Upper limit for small distances (meter).
Returns:
A LatLon2Tuple(lat, lon) with the lat- and longitude of the intersection point.
Raises:
  • IntersectionError - Ambiguous or infinite intersection or colinear, parallel or otherwise non-intersecting lines.
  • TypeError - Invalid datum.
  • UnitError - Invalid lat1, lon1, bearing1, lat2, lon2 or bearing2.

See Also: Method RhumbLine.intersection2.

Note: The returned intersections may be near-antipodal.

intersections2 (lat1, lon1, radius1, lat2, lon2, radius2, datum=None, wrap=False, small=100000.0)

 

Conveniently compute the intersections of two circles each defined by a (geodetic) center point and a radius, using either ...

1) vector3d.intersections2 for small distances (below 100 Km or about 0.88 degrees) or if no datum is specified, or ...

2) spherical.trigonometry.intersections2 for a spherical datum or a scalar datum representing the earth radius, conventionally in meter or ...

3) ellipsoidal.karney.intersections2 for an ellipsoidal datum and if Karney's geographiclib is installed, otherwise ...

4) ellipsoidal.exact.intersections2, provided datum is ellipsoidal.

Arguments:
  • lat1 - Latitude of the first circle center (degrees).
  • lon1 - Longitude of the first circle center (degrees).
  • radius1 - Radius of the first circle (meter, conventionally).
  • lat2 - Latitude of the second circle center (degrees).
  • lon2 - Longitude of the second circle center (degrees).
  • radius2 - Radius of the second circle (meter, same units as radius1).
  • datum - Optional datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) or scalar earth radius (meter, same units as radius1 and radius2) or None.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
  • small - Upper limit for small distances (meter).
Returns:
2-Tuple of the intersection points, each a LatLon2Tuple(lat, lon). For abutting circles, the points are the same instance, aka the radical center.
Raises:
  • IntersectionError - Concentric, antipodal, invalid or non-intersecting circles or no convergence.
  • TypeError - Invalid datum.
  • UnitError - Invalid lat1, lon1, radius1, lat2, lon2 or radius2.

isantipode (lat1, lon1, lat2, lon2, eps=2.220446049250313e-16)

 

Check whether two points are antipodal, on diametrically opposite sides of the earth.

Arguments:
  • lat1 - Latitude of one point (degrees).
  • lon1 - Longitude of one point (degrees).
  • lat2 - Latitude of the other point (degrees).
  • lon2 - Longitude of the other point (degrees).
  • eps - Tolerance for near-equality (degrees).
Returns:
True if points are antipodal within the eps tolerance, False otherwise.

See Also: Functions isantipode_ and antipode.

isantipode_ (phi1, lam1, phi2, lam2, eps=2.220446049250313e-16)

 

Check whether two points are antipodal, on diametrically opposite sides of the earth.

Arguments:
  • phi1 - Latitude of one point (radians).
  • lam1 - Longitude of one point (radians).
  • phi2 - Latitude of the other point (radians).
  • lam2 - Longitude of the other point (radians).
  • eps - Tolerance for near-equality (radians).
Returns:
True if points are antipodal within the eps tolerance, False otherwise.

See Also: Functions isantipode and antipode_.

isnormal (lat, lon, eps=0)

 

Check whether lat and lon are within their respective normal range in degrees.

Arguments:
  • lat - Latitude (degrees).
  • lon - Longitude (degrees).
  • eps - Optional tolerance degrees).
Returns:
True if (abs(lat) + eps) <= 90 and (abs(lon) + eps) <= 180, False othwerwise.

See Also: Functions isnormal_ and normal.

isnormal_ (phi, lam, eps=0)

 

Check whether phi and lam are within their respective normal range in radians.

Arguments:
  • phi - Latitude (radians).
  • lam - Longitude (radians).
  • eps - Optional tolerance radians).
Returns:
True if (abs(phi) + eps) <= PI/2 and (abs(lam) + eps) <= PI, False othwerwise.

See Also: Functions isnormal and normal_.

latlon2n_xyz (lat, lon, name='')

 

Convert lat-, longitude to n-vector (normal to the earth's surface) X, Y and Z components.

Arguments:
  • lat - Latitude (degrees).
  • lon - Longitude (degrees).
  • name - Optional name (str).
Returns:
A Vector3Tuple(x, y, z).

See Also: Function philam2n_xyz.

Note: These are n-vector x, y and z components, NOT geocentric ECEF x, y and z coordinates!

n_xyz2latlon (x, y, z, name='')

 

Convert n-vector components to lat- and longitude in degrees.

Arguments:
  • x - X component (scalar).
  • y - Y component (scalar).
  • z - Z component (scalar).
  • name - Optional name (str).
Returns:
A LatLon2Tuple(lat, lon).

See Also: Function n_xyz2philam.

n_xyz2philam (x, y, z, name='')

 

Convert n-vector components to lat- and longitude in radians.

Arguments:
  • x - X component (scalar).
  • y - Y component (scalar).
  • z - Z component (scalar).
  • name - Optional name (str).
Returns:
A PhiLam2Tuple(phi, lam).

See Also: Function n_xyz2latlon.

normal (lat, lon, name='')

 

Normalize a lat- and longitude pair in degrees.

Arguments:
  • lat - Latitude (degrees).
  • lon - Longitude (degrees).
  • name - Optional name (str).
Returns:
LatLon2Tuple(lat, lon) with abs(lat) <= 90 and abs(lon) <= 180.

See Also: Functions normal_ and isnormal.

normal_ (phi, lam, name='')

 

Normalize a lat- and longitude pair in radians.

Arguments:
  • phi - Latitude (radians).
  • lam - Longitude (radians).
  • name - Optional name (str).
Returns:
PhiLam2Tuple(phi, lam) with abs(phi) <= PI/2 and abs(lam) <= PI.

See Also: Functions normal and isnormal_.

opposing (bearing1, bearing2, margin=90.0)

 

Compare the direction of two bearings given in degrees.

Arguments:
  • bearing1 - First bearing (compass degrees).
  • bearing2 - Second bearing (compass degrees).
  • margin - Optional, interior angle bracket (degrees).
Returns:
True if both bearings point in opposite, False if in similar or None if in perpendicular directions.

See Also: Function opposing_.

opposing_ (radians1, radians2, margin=1.5707963267948966)

 

Compare the direction of two bearings given in radians.

Arguments:
  • radians1 - First bearing (radians).
  • radians2 - Second bearing (radians).
  • margin - Optional, interior angle bracket (radians).
Returns:
True if both bearings point in opposite, False if in similar or None if in perpendicular directions.

See Also: Function opposing.

philam2n_xyz (phi, lam, name='')

 

Convert lat-, longitude to n-vector (normal to the earth's surface) X, Y and Z components.

Arguments:
  • phi - Latitude (radians).
  • lam - Longitude (radians).
  • name - Optional name (str).
Returns:
A Vector3Tuple(x, y, z).

See Also: Function latlon2n_xyz.

Note: These are n-vector x, y and z components, NOT geocentric ECEF x, y and z coordinates!

pierlot (point1, point2, point3, alpha12, alpha23, useZ=False, eps=2.220446049250313e-16, Clas=None, **Clas_kwds)

 

3-Point resection using Pierlot's method ToTal with approximate limits for the (pseudo-)singularities.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • alpha12 - Angle subtended from point1 to point2 or alpha2 - alpha1 (degrees).
  • alpha23 - Angle subtended from point2 to point3 or alpha3 - alpha2(degrees).
  • useZ - If True, interpolate the survey point's Z component, otherwise use z=INT0 (bool).
  • eps - Tolerance for cot (pseudo-)singularities (float).
  • Clas - Optional class to return the survey point, if None use point1's (sub-)class.
  • Clas_kwds - Optional, additional keyword arguments for the survey point instance.
Returns:
The survey (or robot) point, an instance of Clas or if Clas is None an instance of point1's (sub-)class.
Raises:
  • ResectionError - Near-coincident, -colinear or -concyclic points or invalid alpha12 or alpha23 or non-positive eps.
  • TypeError - Invalid point1, point2 or point3.

pierlotx (point1, point2, point3, alpha1, alpha2, alpha3, useZ=False, Clas=None, **Clas_kwds)

 

3-Point resection using Pierlot's method ToTal with exact limits for the (pseudo-)singularities.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • alpha1 - Angle at point1 (degrees, counter-clockwise).
  • alpha2 - Angle at point2 (degrees, counter-clockwise).
  • alpha3 - Angle at point3 (degrees, counter-clockwise).
  • useZ - If True, interpolate the survey point's Z component, otherwise use z=INT0 (bool).
  • Clas - Optional class to return the survey point, if None use point1's (sub-)class.
  • Clas_kwds - Optional, additional keyword arguments for the survey point instance.
Returns:
The survey (or robot) point, an instance of Clas or if Clas is None an instance of point1's (sub-)class.
Raises:
  • ResectionError - Near-coincident, -colinear or -concyclic points or invalid alpha1, alpha2 or alpha3.
  • TypeError - Invalid point1, point2 or point3.

See Also: Pierlot's C function triangulationPierlot2 and function pygeodesy3.pierlot.

radical2 (distance, radius1, radius2)

 

Compute the radical ratio and radical line of two intersecting circles.

The radical line is perpendicular to the axis thru the centers of the circles at (0, 0) and (distance, 0).

Arguments:
  • distance - Distance between the circle centers (scalar).
  • radius1 - Radius of the first circle (scalar).
  • radius2 - Radius of the second circle (scalar).
Returns:
A Radical2Tuple(ratio, xline) where 0.0 <= ratio <= 1.0 and xline is along the distance.
Raises:

randomrangenerator (seed)

 

Return a seeded random range function generator.

Arguments:
  • seed - Initial, internal Random state (hashable or None).
Returns:
A function to generate random ranges.

Note: Random with seed is None seeds from the current time or from a platform-specific randomness source, if available.

Example:

>>> rrange = randomrangenerator('R')
>>> for r in rrange(n):
>>>    ...  # r is random in 0..n-1

snellius3 (a, b, degC, alpha, beta)

 

Snellius' surveying using Snellius Pothenot.

Arguments:
  • a - Length of the triangle side between corners B and C and opposite of triangle corner A (scalar, non-negative meter, conventionally).
  • b - Length of the triangle side between corners C and A and opposite of triangle corner B (scalar, non-negative meter, conventionally).
  • degC - Angle at triangle corner C, opposite triangle side c (non-negative degrees).
  • alpha - Angle subtended by triangle side b (non-negative degrees).
  • beta - Angle subtended by triangle side a (non-negative degrees).
Returns:
Survey3Tuple(PA, PB, PC) with distance from survey point P to each of the triangle corners A, B and C, same units as triangle sides a, b and c.
Raises:
  • TriangleError - Invalid a, b or degC or negative alpha or beta.

See Also: Function pygeodesy3.wildberger3.

thomas (lat1, lon1, lat2, lon2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., wrap=False)

 

Compute the distance between two (ellipsoidal) points using Thomas' formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • datum - Datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as the datum's ellipsoid axes).
Raises:
  • TypeError - Invalid datum.

thomas_ (phi2, phi1, lam21, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)

 

Compute the angular distance between two (ellipsoidal) points using Thomas' formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
  • datum - Datum or ellipsoid to use (Datum, Ellipsoid, Ellipsoid2 or a_f2Tuple).
Returns:
Angular distance (radians).
Raises:
  • TypeError - Invalid datum.

tienstra7 (pointA, pointB, pointC, alpha, beta=None, gamma=None, useZ=False, Clas=None, **Clas_kwds)

 

3-Point resection using Tienstra's formula.

Arguments:
  • pointA - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • pointB - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • pointC - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • alpha - Angle subtended by triangle side a from pointB to pointC (degrees, non-negative).
  • beta - Angle subtended by triangle side b from pointA to pointC (degrees, non-negative) or None if gamma is not None.
  • gamma - Angle subtended by triangle side c from pointA to pointB (degrees, non-negative) or None if beta is not None.
  • useZ - If True, use and interpolate the Z component, otherwise force z=INT0 (bool).
  • Clas - Optional class to return the survey point or None for pointA's (sub-)class.
  • Clas_kwds - Optional, additional keyword arguments for the survey point instance.
Returns:
Tienstra7Tuple(pointP, A, B, C, a, b, c) with survey pointP, an instance of Clas or if Clas is None an instance of pointA's (sub-)class, with triangle angles A at pointA, B at pointB and C at pointC in degrees and with triangle sides a, b and c in meter, conventionally.
Raises:
  • ResectionError - Near-coincident, -colinear or -concyclic points or sum of alpha, beta and gamma not 360 or negative alpha, beta or gamma.
  • TypeError - Invalid pointA, pointB or pointC.

triAngle (a, b, c)

 

Compute one angle of a triangle.

Arguments:
  • a - Adjacent triangle side length (scalar, non-negative meter, conventionally).
  • b - Adjacent triangle side length (scalar, non-negative meter, conventionally).
  • c - Opposite triangle side length (scalar, non-negative meter, conventionally).
Returns:
Angle in radians at triangle corner C, opposite triangle side c.
Raises:

See Also: Functions pygeodesy3.triAngle5 and pygeodesy3.triSide.

triAngle5 (a, b, c)

 

Compute the angles of a triangle.

Arguments:
  • a - Length of the triangle side opposite of triangle corner A (scalar, non-negative meter, conventionally).
  • b - Length of the triangle side opposite of triangle corner B (scalar, non-negative meter, conventionally).
  • c - Length of the triangle side opposite of triangle corner C (scalar, non-negative meter, conventionally).
Returns:
TriAngle5Tuple(radA, radB, radC, rIn, area) with angles radA, radB and radC at triangle corners A, B and C, all in radians, the InCircle radius rIn aka inradius, same units as triangle sides a, b and c and the triangle area in those same units squared.
Raises:

See Also: Functions pygeodesy3.triAngle and pygeodesy3.triArea.

triArea (a, b, c)

 

Compute the area of a triangle using Heron's stable formula.

Arguments:
  • a - Length of the triangle side opposite of triangle corner A (scalar, non-negative meter, conventionally).
  • b - Length of the triangle side opposite of triangle corner B (scalar, non-negative meter, conventionally).
  • c - Length of the triangle side opposite of triangle corner C (scalar, non-negative meter, conventionally).
Returns:
The triangle area (float, conventionally meter or same units as a, b and c squared).
Raises:

triSide (a, b, radC)

 

Compute one side of a triangle.

Arguments:
  • a - Adjacent triangle side length (scalar, non-negative meter, conventionally).
  • b - Adjacent triangle side length (scalar, non-negative meter, conventionally).
  • radC - Angle included by sides a and b, opposite triangle side c (radians).
Returns:
Length of triangle side c, opposite triangle corner C and angle radC, same units as a and b.
Raises:

triSide2 (b, c, radB)

 

Compute a side and its opposite angle of a triangle.

Arguments:
  • b - Adjacent triangle side length (scalar, non-negative meter, conventionally).
  • c - Adjacent triangle side length (scalar, non-negative meter, conventionally).
  • radB - Angle included by sides a and c, opposite triangle side b (radians).
Returns:
TriSide2Tuple(a, radA) with triangle angle radA in radians and length of the opposite triangle side a, same units as b and c.
Raises:

triSide4 (radA, radB, c)

 

Compute two sides and the height of a triangle.

Arguments:
  • radA - Angle at triangle corner A, opposite triangle side a (non-negative radians).
  • radB - Angle at triangle corner B, opposite triangle side b (non-negative radians).
  • c - Length of triangle side between triangle corners A and B, (scalar, non-negative meter, conventionally).
Returns:
TriSide4Tuple(a, b, radC, d) with triangle sides a and b and triangle height d perpendicular to triangle side c, all in the same units as c and interior angle radC in radians at triangle corner C, opposite triangle side c.
Raises:

vincentys (lat1, lon1, lat2, lon2, radius=6371008.771415, wrap=False)

 

Compute the distance between two (spherical) points using Vincenty's spherical formula.

Arguments:
  • lat1 - Start latitude (degrees).
  • lon1 - Start longitude (degrees).
  • lat2 - End latitude (degrees).
  • lon2 - End longitude (degrees).
  • radius - Mean earth radius (meter), datum (Datum) or ellipsoid (Ellipsoid, Ellipsoid2 or a_f2Tuple) to use.
  • wrap - If True, wrap or normalize and unroll lat2 and lon2 (bool).
Returns:
Distance (meter, same units as radius).
Raises:

See Also: Functions vincentys_, cosineAndoyerLambert, cosineForsytheAndoyerLambert,cosineLaw, equirectangular, euclidean, flatLocal/hubeny, flatPolar, haversine and thomas and methods Ellipsoid.distance2, LatLon.distanceTo* and LatLon.equirectangularTo.

Note: See note at function vincentys_.

vincentys_ (phi2, phi1, lam21)

 

Compute the angular distance between two (spherical) points using Vincenty's spherical formula.

Arguments:
  • phi2 - End latitude (radians).
  • phi1 - Start latitude (radians).
  • lam21 - Longitudinal delta, end-start (radians).
Returns:
Angular distance (radians).

See Also: Functions vincentys, cosineAndoyerLambert_, cosineForsytheAndoyerLambert_, cosineLaw_, equirectangular_, euclidean_, flatLocal_/hubeny_, flatPolar_, haversine_ and thomas_.

Note: Functions vincentys_, haversine_ and cosineLaw_ produce equivalent results, but vincentys_ is suitable for antipodal points and slightly more expensive (3 cos, 3 sin, 1 hypot, 1 atan2, 6 mul, 2 add) than haversine_ (2 cos, 2 sin, 2 sqrt, 1 atan2, 5 mul, 1 add) and cosineLaw_ (3 cos, 3 sin, 1 acos, 3 mul, 1 add).

wildberger3 (a, b, c, alpha, beta, R3=<built-in function min>)

 

Snellius' surveying using Rational Trigonometry.

Arguments:
  • a - Length of the triangle side between corners B and C and opposite of triangle corner A (scalar, non-negative meter, conventionally).
  • b - Length of the triangle side between corners C and A and opposite of triangle corner B (scalar, non-negative meter, conventionally).
  • c - Length of the triangle side between corners A and B and opposite of triangle corner C (scalar, non-negative meter, conventionally).
  • alpha - Angle subtended by triangle side b (degrees, non-negative).
  • beta - Angle subtended by triangle side a (degrees, non-negative).
  • R3 - Callable to determine R3 from (R3 - C)**2 = D, typically standard Python function min or max, invoked with 2 arguments.
Returns:
Survey3Tuple(PA, PB, PC) with distance from survey point P to each of the triangle corners A, B and C, same units as a, b and c.
Raises:
  • TriangleError - Invalid a, b or c or negative alpha or beta or R3 not callable.