Skip to content

Commit

Permalink
Merge pull request #1105 from kbevers/inv-mercator-precision
Browse files Browse the repository at this point in the history
Improve numerical precision of inverse spherical mercator
  • Loading branch information
kbevers committed Aug 24, 2018
2 parents 502bc55 + 62b8164 commit ee57ac5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PJ_merc.c
Expand Up @@ -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;
}
Expand Down
10 changes: 10 additions & 0 deletions test/gie/builtins.gie
Expand Up @@ -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)
Expand Down

0 comments on commit ee57ac5

Please sign in to comment.