iwfm.gis.distance_sphere

iwfm.gis.distance_sphere(p1, p2, units='km')[source]

Use the Haversine formula to calculate the distance between two (lat,lon) points on a sphere.

p1 = [lat1,lon1], p2 = [lat2,lon2] in degrees units = ‘km’ (default), ‘mi’ for miles, or ‘ft’ for feet

Parameters:
  • p1 (list) – lat, lon coordinates of a point in degrees

  • p2 (list) – lat, lon coordinates of a point in degrees

  • units (str, default='km') – distance units: ‘km’,’mi’ or ‘ft’

Returns:

distance – distance between p1 and p2

Return type:

float