I’m looking for an explanation on why there are 2 different mercator formulas discussed on these sites.
I understand this to be the correct mercator projection algorithm:
http://en.wikipedia.org/wiki/Mercator_projection
y = ln|sec(lat) + tan(lat)|
However, this site refers to something completely different:
http://wiki.openstreetmap.org/wiki/Mercator
#include <math.h>
double lat2y(double a) { return 180/M_PI * log(tan(M_PI/4+a*(M_PI/180)/2)); }
Any ideas?
Both formulas are equal.
The latter formula is more convenient for numerical calculations, because it involves the computation of the trigonometric function only once.