import warnings


def check_wgs_for_distance_calculation(crs):
    """
    This functions evaluates if the crs is wgs 84 and warns if no crs is defined.

    Parameters
    ----------
    crs : 'pyproj.crs.crs.CRS'
        Can be the result of `gdf.crs`

    Returns
    -------
    is_wgs : bool
        True if wgs84 is assumed

    Notes
    ______
    We do not check for planar crs as this is already done when geopandas.length is called.

    Examples
    ---------
    >>> from trackintel.geogr.distances import check_wgs_for_distance_calculation
    >>> check_wgs_for_distance_calculation(triplegs.crs)
    """

    is_wgs = False

    if crs == 4326:
        is_wgs = True

    elif crs is None:
        is_wgs = True
        warnings.warn('Your data is not projected. WGS84 is assumed and for length calculation the haversine '
                      'distance is used')
    return is_wgs