great_circle_distance

typhon.geodesy.great_circle_distance(lat1, lon1, lat2, lon2, r=None)[source]

Calculate the distance between two geographical positions

This is the ‘As-the-crow-flies’ distance between two points, specified by their latitude and longitude. This uses the so-called haversine formula, defined by:

d=2arcsin(sin(φ2φ12)2+cos(φ1)cos(φ1)sin(λ2λ12)2)
Parameters:
  • lat1 – Latitude of position 1.

  • lon1 – Longitude of position 1.

  • lat2 – Latitude of position 2.

  • lon2 – Longitude of position 2.

  • r (float) – The radius (common for both points).

Returns:

If the optional argument r is given, the distance in m is returned. Otherwise the angular distance in degrees is returned.