diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-08-13 21:20:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-13 21:20:39 +0200 |
| commit | a7ee29e57a8e3df29dc3d340b9eace8c3b49f3ff (patch) | |
| tree | 4af4b4fd178d54a80f2a4a34889910da6eecfd68 | |
| parent | 0dc5cba6b8f286caf3ac0c71f285e8b3d47acfa9 (diff) | |
| parent | a768a013f74fa2815167da67b99e23da21c55d38 (diff) | |
| download | PROJ-a7ee29e57a8e3df29dc3d340b9eace8c3b49f3ff.tar.gz PROJ-a7ee29e57a8e3df29dc3d340b9eace8c3b49f3ff.zip | |
Merge pull request #2801 from OSGeo/backport-2800-to-8.1
[Backport 8.1] Inverse laea ellipsoidal: return PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN when appropriates (fixes OSGeo/gdal#4224)
| -rw-r--r-- | src/projections/laea.cpp | 10 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/projections/laea.cpp b/src/projections/laea.cpp index 8c7797e8..22f00d3f 100644 --- a/src/projections/laea.cpp +++ b/src/projections/laea.cpp @@ -145,6 +145,7 @@ static PJ_LP laea_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse switch (Q->mode) { case EQUIT: case OBLIQ: + { xy.x /= Q->dd; xy.y *= Q->dd; rho = hypot(xy.x, xy.y); @@ -153,7 +154,13 @@ static PJ_LP laea_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse lp.phi = P->phi0; return lp; } - sCe = 2. * asin(.5 * rho / Q->rq); + const double asin_argument = .5 * rho / Q->rq; + if( asin_argument > 1 ) + { + proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); + return lp; + } + sCe = 2. * asin(asin_argument); cCe = cos(sCe); sCe = sin(sCe); xy.x *= sCe; @@ -165,6 +172,7 @@ static PJ_LP laea_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse xy.y = rho * cCe; } break; + } case N_POLE: xy.y = -xy.y; /*-fallthrough*/ diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 1f3824c8..19719796 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2582,6 +2582,9 @@ expect -0.001796631 0.000904369 accept -200 -100 expect -0.001796631 -0.000904369 +accept 13000000 0 +expect failure errno coord_transfm_outside_projection_domain + ------------------------------------------------------------------------------- operation +proj=laea +R=6400000 ------------------------------------------------------------------------------- |
