Nav calc bearing

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

bearing = nav_calc_bearing(bearing_type, lat1, lon1, lat2, lon2)

nav_calc_bearing is used to calculate the bearing from the first coordinate to the second coordinate.

Return value

Argument Type Description
bearing Number Return value. This value is the bearing from the first coordinate to the second coordinate.

Arguments

# Argument Type Description
1 bearing_type String The type of bearing. This can be "GREAT_CIRCLE_START" or "RHUMB_LINE".
2 lat1 Number The latitude of coordinate 1. Use positive for north and negative for south.
3 lon1 Number The longitude of coordinate 1. Use positive for east and negative for west.
4 lat2 Number The longitude of coordinate 2. Use positive for east and negative for west.
5 lon2 Number The longitude of coordinate 2. Use positive for east and negative for west.

Example

-- Returns 134.97072337671 degrees
bearing = calculate_bearing("GREAT_CIRCLE_START", 59.6727385, 9.5388091, 56.1731387, 15.5653304)

-- Returns 349.98012992945 degrees
bearing = calculate_bearing("RHUMB_LINE", 42.2445844, 1.0406613, 54.9958871, -2.3930225)