Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
geodetic latitudes
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
deg : bool, optional
degrees input/output (False: radians in/out)
Results
-------
dist : "ndarray"
distance (meters)
"""
if deg:
lat1, lat2 = radians(lat1), radians(lat2)
rlat1 = geodetic2rectifying(lat1, ell, deg=False)
rlat2 = geodetic2rectifying(lat2, ell, deg=False)
return rsphere_rectifying(ell) * abs(rlat2 - rlat1)
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
deg : bool, optional
degrees input/output (False: radians in/out)
Results
-------
dist : "ndarray"
distance (meters)
"""
if deg:
lat1, lat2 = radians(lat1), radians(lat2)
rlat1 = geodetic2rectifying(lat1, ell, deg=False)
rlat2 = geodetic2rectifying(lat2, ell, deg=False)
return rsphere_rectifying(ell) * abs(rlat2 - rlat1)
def loxodrome_direct_point(
lat1: float, lon1: float, rng: float, a12: float, ell: Ellipsoid = None, deg: bool = True
) -> typing.Tuple[float, float]:
if deg:
lat1, lon1, a12 = radians(lat1), radians(lon1), radians(a12)
if abs(lat1) > pi / 2:
raise ValueError("-90 <= latitude <= 90")
if rng < 0:
raise ValueError("ground distance must be >= 0")
# compute rectifying sphere latitude and radius
reclat = geodetic2rectifying(lat1, ell, deg=False)
# compute the new points
cosaz = cos(a12)
lat2 = reclat + (rng / rsphere_rectifying(ell)) * cosaz # compute rectifying latitude
lat2 = rectifying2geodetic(lat2, ell, deg=False) # transform to geodetic latitude
newiso = geodetic2isometric(lat2, ell, deg=False)
iso = geodetic2isometric(lat1, ell, deg=False)
dlon = tan(a12) * (newiso - iso)
lon2 = lon1 + dlon
if deg:
lat2, lon2 = degrees(lat2), degrees(lon2)
return lat2, lon2