diff options
| author | Andrew Bell <andrew.bell.ia@gmail.com> | 2019-05-15 10:47:03 -0400 |
|---|---|---|
| committer | Andrew Bell <andrew.bell.ia@gmail.com> | 2019-05-15 10:47:03 -0400 |
| commit | 8f268409d37cea329d263e177b83e42f8384d3c7 (patch) | |
| tree | c4d0f3dd19456600f718a6e0c8573577f433549b /src/projections/eqdc.cpp | |
| parent | 886ced02f0aaab5d66d16459435f7447cf976650 (diff) | |
| parent | d67203a6f76a74f5ac029ff052dbcc72e3b59624 (diff) | |
| download | PROJ-8f268409d37cea329d263e177b83e42f8384d3c7.tar.gz PROJ-8f268409d37cea329d263e177b83e42f8384d3c7.zip | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/projections/eqdc.cpp')
| -rw-r--r-- | src/projections/eqdc.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/projections/eqdc.cpp b/src/projections/eqdc.cpp index d175d4a1..e050a593 100644 --- a/src/projections/eqdc.cpp +++ b/src/projections/eqdc.cpp @@ -25,7 +25,7 @@ PROJ_HEAD(eqdc, "Equidistant Conic") # define EPS10 1.e-10 -static PJ_XY e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */ +static PJ_XY eqdc_e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */ PJ_XY xy = {0.0,0.0}; struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); @@ -38,7 +38,7 @@ static PJ_XY e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */ } -static PJ_LP e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse */ +static PJ_LP eqdc_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse */ PJ_LP lp = {0.0,0.0}; struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); @@ -84,12 +84,14 @@ PJ *PROJECTION(eqdc) { Q->phi1 = pj_param(P->ctx, P->params, "rlat_1").f; Q->phi2 = pj_param(P->ctx, P->params, "rlat_2").f; + if (fabs(Q->phi1) > M_HALFPI || fabs(Q->phi2) > M_HALFPI) + return destructor(P, PJD_ERR_LAT_LARGER_THAN_90); if (fabs(Q->phi1 + Q->phi2) < EPS10) - return pj_default_destructor (P, PJD_ERR_CONIC_LAT_EQUAL); + return destructor (P, PJD_ERR_CONIC_LAT_EQUAL); if (!(Q->en = pj_enfn(P->es))) - return pj_default_destructor(P, ENOMEM); + return destructor(P, ENOMEM); Q->n = sinphi = sin(Q->phi1); cosphi = cos(Q->phi1); @@ -104,6 +106,10 @@ PJ *PROJECTION(eqdc) { cosphi = cos(Q->phi2); Q->n = (m1 - pj_msfn(sinphi, cosphi, P->es)) / (pj_mlfn(Q->phi2, sinphi, cosphi, Q->en) - ml1); + if (Q->n == 0) { + // Not quite, but es is very close to 1... + return destructor(P, PJD_ERR_INVALID_ECCENTRICITY); + } } Q->c = ml1 + m1 / Q->n; Q->rho0 = Q->c - pj_mlfn(P->phi0, sin(P->phi0), @@ -115,8 +121,8 @@ PJ *PROJECTION(eqdc) { Q->rho0 = Q->c - P->phi0; } - P->inv = e_inverse; - P->fwd = e_forward; + P->inv = eqdc_e_inverse; + P->fwd = eqdc_e_forward; return P; } |
