pyguymer3.geo.calc_dist_between_two_locs

pyguymer3.geo.calc_dist_between_two_locs(lon1_deg, lat1_deg, lon2_deg, lat2_deg, /, *, eps=1e-12, nIter=100)[source]

Calculate the distance between two coordinates.

This function reads in two coordinates (in degrees) on the surface of the Earth and calculates the Geodesic distance (in metres) between them and the headings (in degrees) from each coordinate to the other one.

Parameters:
  • lon1_deg (float) – the longitude of the first coordinate (in degrees)

  • lat1_deg (float) – the latitude of the first coordinate (in degrees)

  • lon2_deg (float) – the longitude of the second coordinate (in degrees)

  • lat2_deg (float) – the latitude of the second coordinate (in degrees)

  • eps (float, optional) – the tolerance of the Vincenty formula iterations

  • nIter (int, optional) – the maximum number of iterations (particularly the Vincenty formula)

Returns:

  • s_m (float) – the distance between the two coordinates (in metres)

  • alpha1_deg (float) – the heading to the second coordinate from the first coordinate (in degrees)

  • alpha2_deg (float) – the heading to the first coordinate from the second coordinate (in degrees)

Notes

This function uses Vincenty’s formulae ; there is a JavaScript implementation online too.

lambda is a reserved word in Python so I use lam as my variable name instead.

Copyright 2017 Thomas Guymer [1]

References