import warnings


def report_conflict(id,already_saved_geom,conflicting_geom,logger=None):
    """Compare conflicting geometries
     # The geometry that was already inferred from another direction
     # The new geom that apparently is not exactly the same

     Raises warning / write to log whether the difference is major or minor

     """
    # try to calculate distance:
    distance_between_geoms = already_saved_geom.distance(conflicting_geom)
    if distance_between_geoms < 100:  # displacement is less than 100 m
        warning = 'Minor conflicting geoms for id = {}, distance between '.format(id) + \
                  'original and conflicting geom = {} m'.format(distance_between_geoms)
    else:
        warning = 'Major conflicting geoms for id = {}, distance between '.format(id) + \
                  'original and conflicting geom = {} m'.format(distance_between_geoms)
    if not logger == None:
        logger.warning(warning)
    else:
        warnings.warn(warning)
    return warning