Worldmap mercator projection - Latitude to Y calculation.

"R.Wieser" <[email protected]> Wed, 14 Jan 2026 09:24:17 +0100
Newsgroups alt.comp.os.windows-xp,alt.windows7.general,alt.comp.os.windows-10
Organization A noiseless patient Spider
Message-ID <[email protected]>
Hello all,

I have a world map using the Mercator projection, and would like to plot 
some stuff on it using Latitude and Longitude.

The problem is that I can't seem to get the formule I found to spit out the
correct value for Y.

-- The map :

https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Mercator_projection_Square.JPG/250px-Mercator_projection_Square.JPG

-- The formula :

Y = ln( tan(latitude) + sec(latitude) )

where "ln(...)" is log(...) / log(10)

... at least, that is what I could google about it.

where "sec(...)" is 1/cos(...)

-- The test data :

New York : Latitude = 39 (Longitude = -77)

-- Applying the formula and checking the partial results :

RadLat = DegToRad(39) -> 0.680952380952381

Temp = tan(RadLat) + 1/cos(RadLat) -> 2.09728292053088

log(Temp)/log(10) -> 0.321657020135087

Multiplying half the maps height by the above tells me that New York is
located somewhere in Canada. :-(

Can anyone tell me what goes wrong here ?

Regards,
Rudy Wieser