import math


def latlon_to_mercator(lat, lon):
    """Converts latitude/longitude coordinates from decimal degrees to web mercator format.

    Derived from the Java version shown here: http://wiki.openstreetmap.org/wiki/Mercator

    Args:
        lat: latitude in decimal degrees format.
        lon: longitude in decimal degrees format.

    Returns:
        Latitude (y) and longitude (x) as floats.
    """

    radius = 6378137.0
    x = math.radians(lon) * radius
    y = math.log(math.tan(math.radians(lat) / 2.0 + math.pi / 4.0)) * radius

    return y, x