import math


def haversine(lat1, lon1, lat2, lon2):
    """
    Haversine Formula - Distance between two GPS points)
    :param lat1: latitude of the 1st point
    :param lon1: longitude of the 2nd point
    :param lat2: latitudes of the 2nd point
    :param lon2: longitude of the 2nd point
    :return: distance between latitudes and longitudes in kilometers
    """
    dLat = (lat2 - lat1) * math.pi / 180.0
    dLon = (lon2 - lon1) * math.pi / 180.0

    # convert to radians
    lat1 = (lat1) * math.pi / 180.0
    lat2 = (lat2) * math.pi / 180.0

    # apply formulae
    a = (pow(math.sin(dLat / 2), 2) +
         pow(math.sin(dLon / 2), 2) *
         math.cos(lat1) * math.cos(lat2));
    rad = 6371
    c = 2 * math.asin(math.sqrt(a))
    return rad * c