Note
Go to the end to download the full example code.
Required Slope & Destination Point Applying Slope For Distance and Bearing
Computes the required climb/descent slope and horizontal distance between two WGS84 waypoints.
Computes the destination waypoint (lat, lon, alt) from an initial waypoint, given a slope, horizontal distance and bearing.
Uses three different geodesic algorithms: Vincenty, Haversine, and Rhumb-Line.
=== Vincenty ===
Required slope from waypoint1 → waypoint2:
Slope = -2.99961347°
Horizontal distance = 9.69865646 NM
Destination waypoint applying slope & distance:
Latitude = 52.288069°
Longitude = 21.027576°
Altitude = 7959.57 ft
=== Haversine ===
Required slope from waypoint1 → waypoint2:
Slope = -3.00793832°
Horizontal distance = 9.67176503 NM
Destination waypoint applying slope & distance:
Latitude = 52.288103°
Longitude = 21.028590°
Altitude = 7959.57 ft
=== RhumbLine ===
Required slope from waypoint1 → waypoint2:
Slope = -3.00793696°
Horizontal distance = 9.67176941 NM
Destination waypoint applying slope & distance:
Latitude = 52.236724°
Longitude = 20.711886°
Altitude = 7959.57 ft
from pyBADA import conversions as conv
from pyBADA import geodesic as geo
# ——— Inputs for required–slope example ———
waypoint1 = {
"latitude": 52.2367946579192,
"longitude": 20.7129809016565,
"altitude": 3500.0, # ft
}
waypoint2 = {
"latitude": 52.1697191213371,
"longitude": 20.9519554471793,
"altitude": 412.0, # ft
}
# ——— Inputs for destination–point example ———
initial_waypoint = waypoint1.copy()
slope_deg = 3.5 # degrees (positive = climb)
distance_nm = 12.0 # nautical miles
bearing_deg = 75.0 # degrees from true north
# ——— Run both examples for each algorithm ———
for algo_name, Algo in [
("Vincenty", geo.Vincenty),
("Haversine", geo.Haversine),
("RhumbLine", geo.RhumbLine),
]:
print(f"\n=== {algo_name} ===")
# 1) Required slope & horizontal distance
slope_req_deg, dist_m = Algo.requiredSlope(waypoint1, waypoint2)
dist_nm = conv.m2nm(dist_m)
print("Required slope from waypoint1 → waypoint2:")
print(f" Slope = {slope_req_deg:.8f}°")
print(f" Horizontal distance = {dist_nm:.8f} NM")
# 2) Destination point given a slope, distance & bearing
dest_wp = Algo.destinationPointApplyingSlopeForDistance(
initial_waypoint, slope_deg, distance_nm, bearing_deg
)
print("Destination waypoint applying slope & distance:")
print(f" Latitude = {dest_wp['latitude']:.6f}°")
print(f" Longitude = {dest_wp['longitude']:.6f}°")
print(f" Altitude = {dest_wp['altitude']:.2f} ft")
Total running time of the script: (0 minutes 0.002 seconds)