import math


def calculate_offset_point(x, y, d, b):
    """Calculate an offset point for a given lat, lon, distance and bearing.
    formula source: https://www.movable-type.co.uk/scripts/latlong.html

    :param x: longitude in decimal degrees
    :param y: latitude in decimal degrees
    :param d: distance in km
    :param b: bearing in degrees
    :return: new x, y in decimal degrees
    """
    R = 6378.137  # km
    x, y, b = math.radians(x), math.radians(y), math.radians(b)
    new_y = math.asin(
        (math.sin(y) * math.cos(d / R)) + (math.cos(y) * math.sin(d / R) * math.cos(b))
    )
    new_x = x + math.atan2(
        math.sin(b) * math.sin(d / R) * math.cos(y),
        math.cos(d / R) - math.sin(y) * math.sin(new_y),
    )

    return math.degrees(new_x), math.degrees(new_y)