diff options
| -rw-r--r-- | src/projections/urm5.cpp | 6 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/projections/urm5.cpp b/src/projections/urm5.cpp index a93293c0..f89bb1d5 100644 --- a/src/projections/urm5.cpp +++ b/src/projections/urm5.cpp @@ -45,7 +45,11 @@ PJ *PROJECTION(urm5) { Q->q3 = pj_param(P->ctx, P->params, "dq").f / 3.; alpha = pj_param(P->ctx, P->params, "ralpha").f; t = Q->n * sin (alpha); - Q->m = cos (alpha) / sqrt (1. - t * t); + const double denom = sqrt (1. - t * t); + if( denom == 0 ) { + return pj_default_destructor(P, PJD_ERR_LAT_0_OR_ALPHA_EQ_90); + } + Q->m = cos (alpha) / denom; Q->rmn = 1. / (Q->m * Q->n); P->es = 0.; diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 97009cff..bb5379fe 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -5253,7 +5253,7 @@ Urmaev V =============================================================================== ------------------------------------------------------------------------------- -operation +proj=urm5 +a=6400000 +lat_1=0.5 +lat_2=2 +n=0.5 +operation +proj=urm5 +a=6400000 +n=0.5 ------------------------------------------------------------------------------- tolerance 0.1 mm accept 2 1 @@ -5265,6 +5265,8 @@ expect -223393.638433964 111696.818785117 accept -2 -1 expect -223393.638433964 -111696.818785117 +operation +proj=urm5 +a=6400000 +n=1 +alpha=90 +expect failure errno lat_0_or_alpha_eq_90 =============================================================================== Urmaev Flat-Polar Sinusoidal |
