# How does latitude of origin work in Mercator

I'm trying to make a coordinate transformation using GDAL/osr python bindings. I have a longitude an a latitude and I want to transform them into the mercator coordinates.

So I define the mercator projection as:

``````srs = osr.SpatialReference()
srs.SetMercator(41.602, 2.403, 1, 0, 0);
``````

and the input point projection as

``````srs2 = osr.SpatialReference()
srs2.SetWellKnownGeogCS("EPSG:4326")
``````

When I transform the point supposed to be 0,0 in the mercator projection, using

``````transf = CoordinateTransformation(srs2,srs)
transf.TransformPoint((2.403,41.602))
``````

The x result is 0, as expected, but the y is a high number: 3799198

What am I doing wrong?

-

It's a feature of the underlying Proj4 library, and the definition of a Mercator projection. When you set the `latitude_of_origin` value to 41.602, what you're really setting is the latitude of true scale - which can be visualised as reducing the diameter of the Mercator cylinder until it matches the diameter of the spheroid at that latitude. But the cylinder still points straight "up", so your value of 3799198 is the number of metres from the equator to your latitude of true scale. To counter this, you'll need to specify a false northing:
``````srs.SetMercator(41.602, 2.403, 1, 0, -3799198.5783426273)