diff options
| -rw-r--r-- | src/ell_set.cpp | 20 | ||||
| -rw-r--r-- | src/init.cpp | 2 | ||||
| -rw-r--r-- | src/proj_internal.h | 2 | ||||
| -rw-r--r-- | src/strerrno.cpp | 2 | ||||
| -rw-r--r-- | test/gie/ellipsoid.gie | 3 |
5 files changed, 18 insertions, 11 deletions
diff --git a/src/ell_set.cpp b/src/ell_set.cpp index 4c9fc892..71746895 100644 --- a/src/ell_set.cpp +++ b/src/ell_set.cpp @@ -280,8 +280,8 @@ static int ellps_shape (PJ *P) { P->es = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->es) return proj_errno_set (P, PJD_ERR_INVALID_ARG); - if (1==P->es) - return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE); + if (P->es >= 1) + return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); break; /* eccentricity, e */ @@ -291,8 +291,8 @@ static int ellps_shape (PJ *P) { return proj_errno_set (P, PJD_ERR_INVALID_ARG); if (0==P->e) return proj_errno_set (P, PJD_ERR_INVALID_ARG); - if (1==P->e) - return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE); + if (P->e >= 1) + return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); P->es = P->e * P->e; break; @@ -301,8 +301,8 @@ static int ellps_shape (PJ *P) { P->b = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->b) return proj_errno_set (P, PJD_ERR_INVALID_ARG); - if (0==P->b) - return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE); + if (P->b <= 0) + return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); if (P->b==P->a) break; P->f = (P->a - P->b) / P->a; @@ -556,8 +556,8 @@ int pj_calc_ellipsoid_params (PJ *P, double a, double es) { P->one_es = 1. - P->es; if (P->one_es == 0.) { - pj_ctx_set_errno( P->ctx, PJD_ERR_ECCENTRICITY_IS_ONE); - return PJD_ERR_ECCENTRICITY_IS_ONE; + pj_ctx_set_errno( P->ctx, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); + return PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER; } P->rone_es = 1./P->one_es; @@ -712,6 +712,10 @@ bomb: pj_ctx_set_errno(ctx, PJD_ERR_ES_LESS_THAN_ZERO); return 1; } + if (*es >= 1.) { + pj_ctx_set_errno(ctx, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); + return 1; + } if (*a <= 0.) { pj_ctx_set_errno(ctx, PJD_ERR_MAJOR_AXIS_NOT_GIVEN); return 1; diff --git a/src/init.cpp b/src/init.cpp index 2961bcca..13ea4ae8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -680,7 +680,7 @@ pj_init_ctx_with_allow_init_epsg(projCtx ctx, int argc, char **argv, int allow_i PIN->a_orig = PIN->a; PIN->es_orig = PIN->es; if (pj_calc_ellipsoid_params (PIN, PIN->a, PIN->es)) - return pj_default_destructor (PIN, PJD_ERR_ECCENTRICITY_IS_ONE); + return pj_default_destructor (PIN, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); /* Now that we have ellipse information check for WGS84 datum */ if( PIN->datum_type == PJD_3PARAM diff --git a/src/proj_internal.h b/src/proj_internal.h index 448b65c8..cdde6bad 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -624,7 +624,7 @@ struct FACTORS { #define PJD_ERR_NO_COLON_IN_INIT_STRING -3 #define PJD_ERR_PROJ_NOT_NAMED -4 #define PJD_ERR_UNKNOWN_PROJECTION_ID -5 -#define PJD_ERR_ECCENTRICITY_IS_ONE -6 +#define PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER -6 #define PJD_ERR_UNKNOWN_UNIT_ID -7 #define PJD_ERR_INVALID_BOOLEAN_PARAM -8 #define PJD_ERR_UNKNOWN_ELLP_PARAM -9 diff --git a/src/strerrno.cpp b/src/strerrno.cpp index 01097a42..5dedef98 100644 --- a/src/strerrno.cpp +++ b/src/strerrno.cpp @@ -14,7 +14,7 @@ pj_err_list[] = { "no colon in init= string", /* -3 */ "projection not named", /* -4 */ "unknown projection id", /* -5 */ - "effective eccentricity = 1.", /* -6 */ + "effective eccentricity >= 1.", /* -6 */ "unknown unit conversion id", /* -7 */ "invalid boolean param argument", /* -8 */ "unknown elliptical parameter name", /* -9 */ diff --git a/test/gie/ellipsoid.gie b/test/gie/ellipsoid.gie index ea7f3888..2a6d02a5 100644 --- a/test/gie/ellipsoid.gie +++ b/test/gie/ellipsoid.gie @@ -134,6 +134,9 @@ expect failure errno rev_flattening_is_zero operation proj=utm zone=32 ellps=GRS80 es=1 expect failure errno eccentricity_is_one +operation proj=utm zone=32 a=1 es=1.1 +expect failure errno eccentricity_is_one + operation proj=utm zone=32 ellps=GRS80 b=0 expect failure errno eccentricity_is_one |
