gps_data_analyzer.utils module

gps_data_analyzer.utils.haversine(lat1, lon1, lat2, lon2, to_radians=True, earth_radius=6371000.0)

Vectorized haversine function

Slightly modified version: of http://stackoverflow.com/a/29546836/2901002

Calculate the great circle distance between two points on the earth (specified in decimal degrees or in radians)

All (lat, lon) coordinates must have numeric dtypes and be of equal length.

Parameters
  • lat1 (numpy.array) – The latitude coordinates of the first point.

  • lon1 (numpy.array) – The longitude coordinates of the first point.

  • lat2 (numpy.array) – The latitude coordinates of the second point.

  • lon2 (numpy.array) – The longitude coordinates of the second point.

  • to_radians (bool, optional) – Convert coordinates in radians.

  • earth_radius (float, optional) – The earth radius used for computations.

Returns

The distances betwen each couple of points.

Return type

numpy.array