From b38d0143a65fff72635b95a61ed6c4c41802889e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 11 Nov 2020 23:56:58 +0100 Subject: Polar stereographic at pole: make it return (0,0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to the improved accuracy of pj_tsfn(), it no longer returns 0 when phi=90° due to the conversion in radians. Some GDAL tests are very sensitive to the pole transforming to (0,0) exactly, so add a special case for that. master only --- src/projections/stere.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/projections/stere.cpp b/src/projections/stere.cpp index abc4aa13..3fff722d 100644 --- a/src/projections/stere.cpp +++ b/src/projections/stere.cpp @@ -86,7 +86,10 @@ static PJ_XY stere_e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forwar sinphi = -sinphi; /*-fallthrough*/ case N_POLE: - xy.x = Q->akm1 * pj_tsfn (lp.phi, sinphi, P->e); + if( fabs(lp.phi - M_HALFPI) < 1e-15 ) + xy.x = 0; + else + xy.x = Q->akm1 * pj_tsfn (lp.phi, sinphi, P->e); xy.y = - xy.x * coslam; break; } -- cgit v1.2.3