.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/combinedSlopeAndDestination.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_combinedSlopeAndDestination.py: Required Slope & Destination Point Applying Slope For Distance and Bearing ========================================================================== 1. Computes the required climb/descent slope and horizontal distance between two WGS84 waypoints. 2. 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. .. GENERATED FROM PYTHON SOURCE LINES 9-54 .. rst-class:: sphx-glr-script-out .. code-block:: none === 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 | .. code-block:: Python 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") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.001 seconds) .. _sphx_glr_download_auto_examples_combinedSlopeAndDestination.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: combinedSlopeAndDestination.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: combinedSlopeAndDestination.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: combinedSlopeAndDestination.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_