Re: Worldmap mercator projection - Latitude to Y calculation. - last try

"R.Wieser" <[email protected]> Mon, 19 Jan 2026 21:11:34 +0100
Newsgroups alt.comp.os.windows-xp,alt.windows7.general,alt.comp.os.windows-10
Organization A noiseless patient Spider
Message-ID <[email protected]>
As I cannot get any formule to work I'm going to try this one last time.

Below are two formules for converting a lattitude on a Mercator-projection 
map into a -1 ... +1 result that needs to be multiplied by half the 
maps-images height and subtracted from the equator (the map-images top-left 
is 0,0).

I've split the calculations up into multiple parts, hoping that someone can 
tell me where one, or perhaps both, go awry.

-- Formule: ln( tan(latitude) + sec(latitude) )

Lat: 39
DegToRad(39) -> 0.680952
tan(0.680952) -> 0.810238
sec(0.680952) -> 1/cos(0.680952) -> 1.287045
ln(0.810238+1.287045) -> log(0.810238+1.287045)/log(10) -> 0.321657

0.321657 is *way* too high.


-- Formule: log( tan(PI/4.0 + rad/2.0) ) / (2.0 * PI)

Lat: 39
DegToRad(39) -> 0.680952
tan(PI/4+0.680952/2) -> 2.098991
log(2.098991) -> 0.741457
0.741457/(2*PI) -> 0.117959

0.117959 is *way* to low

Regards,
Rudy Wieser