Get bearing from start point to end point

Supported in: Batch, Streaming

Calculates the absolute true bearing (clockwise angle relative to geographical north) from the first point to the second point in degrees using a spherical approximation of the earth.

Expression categories: Geospatial

Declared arguments

  • Ending point - Longitude and latitude for the ending point.
    Expression<GeoPoint>
  • Starting point - Longitude and latitude for the starting point.
    Expression<GeoPoint>

Output type: Double

Examples

Example 1: Base case

Argument values:

  • Ending point: end_point
  • Starting point: start_point
start_pointend_pointOutput
{
latitude: 40.69325025929194,
longitude: -74.00522662934995,
}
{
latitude: 51.4988509390695,
longitude: -0.1238396067697046,
}
51.20964213763489

Example 2: Edge case

Argument values:

  • Ending point: end_point
  • Starting point: start_point
start_pointend_pointOutput
{
latitude: -41.304077,
longitude: 174.75,
}
{
latitude: -31.304077,
longitude: 174.749,
}
359.99507958062

Example 3: Edge case

Argument values:

  • Ending point: end_point
  • Starting point: start_point
start_pointend_pointOutput
{
latitude: -41.304077,
longitude: 174.75,
}
{
latitude: -31.304077,
longitude: 174.75,
}
0.0

Example 4: Edge case

Argument values:

  • Ending point: end_point
  • Starting point: start_point
start_pointend_pointOutput
{
latitude: -41.304077,
longitude: 174.774535,
}
{
latitude: 37.42984400901383,
longitude: -122.16950590121428,
}
45.56453711814595

Example 5: Edge case

Argument values:

  • Ending point: end_point
  • Starting point: start_point
start_pointend_pointOutput
nullnullnull

Example 6: Edge case

Argument values:

  • Ending point: end_point
  • Starting point: start_point
start_pointend_pointOutput
{
latitude: 48.8567,
longitude: 2.3508,
}
{
latitude: 48.8567,
longitude: 2.3508,
}
0.0