Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Enhance the precision of Spherical Mercator projection near the equator #928
This uses a linear approximation of tan(x+pi/4) for better precision at small latitudes.
Before this patch:
All values are now more accurate (I checked using arbitrary precision arithmetic), and we have the nice property of preserving the (0,0) coordinates of the origin point.
Perhaps now is a good time to revisit the Mercator formulas. Approximating
Much better, from a numerical point of view, than
I won't get into larger changes like using
Looking at the inverse formula would also be interesting, but similarly I won't get
Looking a bit more in to this it turns out that we have a
There's even a
We are getting close to the point were a dedicated non-C99-math function collection is needed.
I agree... Perhaps we should let this modification go through but queue of a bigger survey of these hygene + accuracy issues.
Note well that several conformal projections use similar formulas (converting between geographic latitude to conformal latitude so that a spherical conformal projection can be used). Off the top of my head, I suspect that
are all candidates for a uniform treatment.
In addition to a C99 math library collection, perhaps it would be good to consider a centralized location for Clenshaw and Horner sums, and the basic ellipsoidal Mercator formulas (for use by etmerc etc.)
The various equal-area projections should also use the same machinery (if they don't already) to do the transformation between geographic latitude and authalic latitude. See also my table of trigonometric series for transformations between all the various latitudes (E+K's series appear here φ − χ and χ − φ).