import math


def convert_to_latlon(y, x, latitude, longitude):
    """
    Convert the latitude and longitude relative to the centroid
    :param y: y of the centroid
    :param x: x of the centroid
    :param latitude:
    :param longitude:
    :return:
    """
    pi = math.pi

    r_earth = 6371000

    lat_diff = (y / r_earth) * (180 / pi)
    lon_diff = (x / r_earth) * (180 / pi) / math.cos(latitude * pi / 180)

    final_lat = latitude + lat_diff
    final_lon = longitude + lon_diff

    return (final_lat, final_lon)