def great_circle_distance()

in src/h3/api/memview_int/__init__.py [0:0]


def great_circle_distance(latlng1, latlng2, unit='km'):
    """
    Compute the spherical distance between two (lat, lng) points.
    AKA: great circle distance or "haversine" distance.

    todo: overload to allow two cell inputs?

    Parameters
    ----------
    latlng1 : tuple
        (lat, lng) tuple in degrees
    latlng2 : tuple
        (lat, lng) tuple in degrees
    unit: str
        Unit for distance result (``'km'``, ``'m'``, or ``'rads'``)

    Returns
    -------
    The spherical distance between the points in the given units
    """
    lat1, lng1 = latlng1
    lat2, lng2 = latlng2
    return _cy.great_circle_distance(
        lat1, lng1,
        lat2, lng2,
        unit = unit
    )