diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-08-24 21:28:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-24 21:28:51 +0200 |
| commit | ee57ac53103e0e0b7edde6f99e835a5c2140df96 (patch) | |
| tree | b610279080f54bb06eec9e435a15976724926c6e | |
| parent | 502bc55cf4f8dd4b9f3cc1a06d7f52c9ba1e9ff5 (diff) | |
| parent | 62b81642ae5226d8aefcc1da7e30cc2d2e65e697 (diff) | |
| download | PROJ-ee57ac53103e0e0b7edde6f99e835a5c2140df96.tar.gz PROJ-ee57ac53103e0e0b7edde6f99e835a5c2140df96.zip | |
Merge pull request #1105 from kbevers/inv-mercator-precision
Improve numerical precision of inverse spherical mercator
| -rw-r--r-- | src/PJ_merc.c | 2 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/PJ_merc.c b/src/PJ_merc.c index 46cd4b3d..1998234e 100644 --- a/src/PJ_merc.c +++ b/src/PJ_merc.c @@ -57,7 +57,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ LP lp = {0.0,0.0}; - lp.phi = M_HALFPI - 2. * atan(exp(-xy.y / P->k0)); + lp.phi = atan(sinh(xy.y / P->k0)); lp.lam = xy.x / P->k0; return lp; } diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 3e2059c1..b5dc3ab1 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2928,6 +2928,16 @@ accept -200 -100 expect -0.001790493 -0.000895247 +------------------------------------------------------------------------------- +operation +proj=merc +R=1 +------------------------------------------------------------------------------- +Test the numerical stability of the inverse spherical Mercator +------------------------------------------------------------------------------- +tolerance 1e-15 m +accept 0 1e-15 +expect 0 1e-15 + + =============================================================================== Miller Oblated Stereographic Azi(mod) |
