aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-11-12 11:46:38 +0100
committerGitHub <noreply@github.com>2020-11-12 11:46:38 +0100
commit1a98229ed2c738bd563122084a08d36b2bf0ebaf (patch)
tree31e8f7a2a015b56f48d3b4c81cd42ca39a0f2c90
parentd5b0ea29b694a24fb1a951f6fe557f2e1bf78e62 (diff)
parentb38d0143a65fff72635b95a61ed6c4c41802889e (diff)
downloadPROJ-1a98229ed2c738bd563122084a08d36b2bf0ebaf.tar.gz
PROJ-1a98229ed2c738bd563122084a08d36b2bf0ebaf.zip
Merge pull request #2422 from rouault/fix_polar_stere_at_pole
Polar stereographic at pole: make it return (0,0)
-rw-r--r--src/projections/stere.cpp5
-rw-r--r--test/gie/builtins.gie26
2 files changed, 30 insertions, 1 deletions
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;
}
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index def30206..add5d925 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -5419,6 +5419,32 @@ accept -200 -100
expect -0.001790493 -0.000895247
+-------------------------------------------------------------------------------
+operation +proj=stere +ellps=GRS80 +lat_0=90 +lat_ts=70
+-------------------------------------------------------------------------------
+tolerance 1e-15m
+accept 0 90
+expect 0 0
+roundtrip 1
+
+tolerance 0.1 mm
+accept 20 70
+expect 748315.3282 -2055979.4669
+roundtrip 1
+
+-------------------------------------------------------------------------------
+operation +proj=stere +ellps=GRS80 +lat_0=-90 +lat_ts=-70
+-------------------------------------------------------------------------------
+tolerance 1e-15m
+accept 0 -90
+expect 0 0
+roundtrip 1
+
+tolerance 0.1 mm
+accept 20 -70
+expect 748315.3282 2055979.4669
+roundtrip 1
+
===============================================================================
# Oblique Stereographic Alternative
# Azimuthal, Sph&Ell