Geodesic

pyBADA Geodesic calculation module Developped @EUROCONTROL (EIH) 2024

class pyBADA.geodesic.Haversine[source]

Bases: object

This class implements the geodesic calculations on sherical earth (ignoring ellipsoidal effects).

static bearing(LAT_init, LON_init, LAT_final, LON_final)[source]

Calculate the initial bearing between two points along a great-circle path.

The initial bearing (forward azimuth) is the direction one would need to travel in a straight line along the great-circle arc from the start point to the end point.

This bearing is measured clockwise from true north.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • LAT_final (float) – Final latitude in degrees.

  • LON_final (float) – Final longitude in degrees.

Returns:

Initial bearing in degrees (0° to 360°).

Return type:

float

static destinationPoint(LAT_init, LON_init, distance, bearing)[source]

Calculate the destination point given an initial point, distance, and bearing.

Given an initial latitude and longitude, this function calculates the destination point after traveling the specified distance along the given initial bearing (direction).

Note that the bearing may vary along the path, but this calculation assumes a constant bearing.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • distance (float) – Distance to travel from the initial point in meters.

  • bearing (float) – Initial bearing (direction) in degrees.

Returns:

Tuple containing the destination latitude and longitude in degrees.

Return type:

(float, float)

static distance(LAT_init, LON_init, LAT_final, LON_final)[source]

Calculate the great-circle distance between two points on the Earth’s surface using the haversine formula.

The great-circle distance is the shortest distance between two points over the Earth’s surface, ignoring elevation changes (i.e., hills or mountains).

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • LAT_final (float) – Final latitude in degrees.

  • LON_final (float) – Final longitude in degrees.

Returns:

Great-circle distance between the two points in meters.

Return type:

float

class pyBADA.geodesic.RhumbLine[source]

Bases: object

This class implements the rhumb line (loxodrome) calculations of geodesics on the ellipsoid-model earth

static bearing(LAT_init, LON_init, LAT_final, LON_final) float[source]

Calculates the rhumbline bearing from the initial point to the final point.

This returns the constant bearing (direction) required to travel along a rhumbline between the two points. The bearing is adjusted for longitudes that cross the 180-degree meridian.

Parameters:
  • LAT_init – Initial latitude in degrees.

  • LON_init – Initial longitude in degrees.

  • LAT_final – Final latitude in degrees.

  • LON_final – Final longitude in degrees.

Returns:

The rhumbline bearing in degrees.

static destinationPoint(LAT_init, LON_init, bearing, distance) tuple[source]

Calculates the destination point given an initial point, a bearing, and a distance traveled.

This method computes the final latitude and longitude after traveling along a rhumbline for a given distance in meters from the initial point at a constant bearing.

Parameters:
  • LAT_init – Initial latitude in degrees.

  • LON_init – Initial longitude in degrees.

  • bearing – The constant bearing in degrees.

  • distance – The distance to travel from the initial point in meters.

Returns:

A tuple containing the destination latitude and longitude in degrees.

static distance(LAT_init, LON_init, LAT_final, LON_final) float[source]

Calculates the rhumbline distance between two geographical points in meters.

The rhumbline is a path of constant bearing that crosses all meridians at the same angle, unlike a great-circle route which is the shortest distance between two points on the Earth’s surface.

This method adjusts for longitudes that span more than half of the globe.

Parameters:
  • LAT_init – Initial latitude in degrees.

  • LON_init – Initial longitude in degrees.

  • LAT_final – Final latitude in degrees.

  • LON_final – Final longitude in degrees.

Returns:

The rhumbline distance in meters.

static loxodromic_mid_point(LAT_init, LON_init, LAT_final, LON_final) tuple[source]

Calculates the midpoint along a rhumbline between two geographical points.

The midpoint is calculated using the rhumbline path between the initial and final points. This takes into account the Earth’s curvature by projecting the latitudes.

Parameters:
  • LAT_init – Initial latitude in degrees.

  • LON_init – Initial longitude in degrees.

  • LAT_final – Final latitude in degrees.

  • LON_final – Final longitude in degrees.

Returns:

A tuple representing the midpoint’s latitude and longitude in degrees.

static loxodromic_power_interpolation(LAT_init, LON_init, LAT_final, LON_final, n_points: int) list[source]

Generates a specified number of points between two geographical locations along a rhumbline path.

This method recursively calculates intermediate points between two points on the Earth’s surface, following a constant bearing rhumbline path. The number of points should be a power of 2 minus 1.

Parameters:
  • LAT_init – Initial latitude in degrees.

  • LON_init – Initial longitude in degrees.

  • LAT_final – Final latitude in degrees.

  • LON_final – Final longitude in degrees.

  • n_points – Number of intermediate points to generate. Must be a power of 2 minus 1.

Returns:

A list of tuples, where each tuple represents an interpolated point’s latitude and longitude in degrees.

static simple_project(latitiude: float) float[source]

Applies a projection to the latitude for use in rhumbline calculations.

The projection is based on the Mercator projection, where latitudes are projected to account for the curvature of the Earth. This formula ensures that the calculations along the rhumbline are accurate.

Parameters:

latitiude – Latitude in radians.

Returns:

The projected latitude in radians.

class pyBADA.geodesic.Turn[source]

Bases: object

This class implements the calculations of geodesics turns

static destinationPoint_finalBearing(LAT_init, LON_init, bearingInit, TAS, rateOfTurn, timeOfTurn, directionOfTurn, centerPoint=None)[source]

Calculates the destination point and final bearing after traveling for a given time with a specified turn.

This function computes the aircraft’s final position and bearing after making a turn at a specified rate of turn, direction, and true airspeed (TAS). If TAS is zero, the aircraft rotates in place. The calculation accounts for turning radius and bank angle.

Parameters:
  • LAT_init (float.) – Initial latitude [deg].

  • LON_init (float.) – Initial longitude [deg].

  • timeOfTurn (float.) – Time spent in turn [s].

  • bearingInit (float.) – Initial bearing [deg].

  • TAS (float.) – True Airspeed (TAS) [m/s].

  • rateOfTurn (float.) – Rate of turn [deg/s].

  • directionOfTurn (str.) – Direction of turn (‘LEFT’ or ‘RIGHT’).

  • centerPoint (tuple(float, float).) – Optional latitude and longitude of the rotation center (defaults to None) [deg, deg].

Returns:

Destination point’s latitude, longitude, and final bearing [deg, deg, deg].

Return type:

tuple(float, float, float).

static distance(rateOfTurn, TAS, timeOfTurn)[source]

Calculates the distance traveled during a turn based on the rate of turn, true airspeed, and time.

This function computes the total distance traveled during a constant turn, based on the aircraft’s rate of turn, true airspeed, and the duration of the turn.

Parameters:
  • rateOfTurn (float.) – Rate of turn [deg/s].

  • TAS (float.) – True Airspeed (TAS) [m/s].

  • timeOfTurn (float.) – Duration of the turn [s].

Returns:

Distance traveled during the turn [m].

Return type:

float.

class pyBADA.geodesic.Vincenty[source]

Bases: object

This class implements the vincenty calculations of geodesics on the ellipsoid-model earth

static bearing_final(LAT_init, LON_init, LAT_final, LON_final)[source]

Calculate the final bearing (reverse azimuth) from the final point to the initial point.

This function calculates the final bearing at the destination point, which is the direction one would need to take to return to the initial point along the great-circle path.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • LAT_final (float) – Final latitude in degrees.

  • LON_final (float) – Final longitude in degrees.

Returns:

The final bearing in degrees.

Return type:

float

static bearing_initial(LAT_init, LON_init, LAT_final, LON_final)[source]

Calculate the initial bearing (forward azimuth) from the initial point to the final point.

This function returns the initial bearing that, if followed in a straight line along a great-circle path, will take you from the start point to the end point.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • LAT_final (float) – Final latitude in degrees.

  • LON_final (float) – Final longitude in degrees.

Returns:

The initial bearing in degrees.

Return type:

float

static destinationPoint(LAT_init, LON_init, distance, bearing)[source]

Calculate the destination point after traveling a specified distance on a given bearing.

This method returns the latitude and longitude of the destination point after traveling the given distance on the specified initial bearing, following a great-circle path.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • distance (float) – Distance to be traveled from the initial point in meters.

  • bearing (float) – Initial bearing (direction) in degrees.

Returns:

Tuple containing the destination latitude and longitude in degrees.

Return type:

(float, float)

static destinationPoint_finalBearing(LAT_init, LON_init, distance, bearing)[source]

Calculate the destination point and final bearing given an initial point, distance, and bearing.

This method calculates the latitude and longitude of the destination point after traveling a specified distance along the given bearing from the starting point. It also returns the final bearing at the destination point.

Note: The bearing normally varies along the path due to the Earth’s curvature.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • distance (float) – Distance traveled from the initial point in meters.

  • bearing (float) – Initial bearing (direction) in degrees.

Returns:

Tuple containing the destination latitude, destination longitude, and final bearing (degrees).

Return type:

(float, float, float)

static distance(LAT_init, LON_init, LAT_final, LON_final)[source]

Calculate the geodesic distance between two latitude/longitude points on the Earth’s surface.

This method uses an accurate ellipsoidal model (Vincenty’s formula) for calculating the distance, which is particularly useful for long distances across the globe.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • LAT_final (float) – Final latitude in degrees.

  • LON_final (float) – Final longitude in degrees.

Returns:

The geodesic distance in meters.

Return type:

float

static distance_bearing(LAT_init, LON_init, LAT_final, LON_final)[source]

Calculate the geodesic distance, initial bearing, and final bearing between two points on the Earth’s surface.

This method uses the Vincenty formula to account for the Earth’s ellipsoidal shape, providing accurate calculations for long distances.

Parameters:
  • LAT_init (float) – Initial latitude in degrees.

  • LON_init (float) – Initial longitude in degrees.

  • LAT_final (float) – Final latitude in degrees.

  • LON_final (float) – Final longitude in degrees.

Returns:

Tuple containing distance in meters, initial bearing in degrees, and final bearing in degrees.

Return type:

(float, float, float)