aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pj_ell_set.c4
-rw-r--r--src/projects.h4
-rw-r--r--test/gie/ellipsoid.gie33
3 files changed, 38 insertions, 3 deletions
diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c
index 8ba928b7..18beb875 100644
--- a/src/pj_ell_set.c
+++ b/src/pj_ell_set.c
@@ -237,6 +237,8 @@ static int pj_shape (PJ *P) {
P->rf = pj_atof (pj_param_value (par));
if (HUGE_VAL==P->rf)
return proj_errno_set (P, PJD_ERR_INVALID_ARG);
+ if (0==P->rf)
+ return proj_errno_set (P, PJD_ERR_REV_FLATTENING_IS_ZERO);
P->f = 1 / P->rf;
P->es = 2*P->f - P->f*P->f;
break;
@@ -279,7 +281,7 @@ static int pj_shape (PJ *P) {
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_INVALID_ARG);
+ return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE);
P->f = (P->a - P->b) / P->a;
P->es = 2*P->f - P->f*P->f;
break;
diff --git a/src/projects.h b/src/projects.h
index f8f1fa38..91c0e6a3 100644
--- a/src/projects.h
+++ b/src/projects.h
@@ -479,14 +479,14 @@ enum deprecated_constants_for_now_dropped_analytical_factors {
/* library errors */
#define PJD_ERR_NO_ARGS -1
#define PJD_ERR_NO_OPTION_IN_INIT_FILE -2
-#define PJD_ERR_NO_COLOR_IN_INIT_STRING -3
+#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_UNKNOW_UNIT_ID -7
#define PJD_ERR_INVALID_BOOLEAN_PARAM -8
#define PJD_ERR_UNKNOWN_ELLP_PARAM -9
-#define PJD_ERR_REC_FLATTENING_IS_ZERO -10
+#define PJD_ERR_REV_FLATTENING_IS_ZERO -10
#define PJD_ERR_REF_RAD_LARGER_THAN_90 -11
#define PJD_ERR_ES_LESS_THAN_ZERO -12
#define PJD_ERR_MAJOR_AXIS_NOT_GIVEN -13
diff --git a/test/gie/ellipsoid.gie b/test/gie/ellipsoid.gie
index 120e407d..63901bc9 100644
--- a/test/gie/ellipsoid.gie
+++ b/test/gie/ellipsoid.gie
@@ -118,4 +118,37 @@ accept -90 0
expect -1.56904 0
-------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
+Shape parameters
+-------------------------------------------------------------------------------
+operation proj=utm zone=32 ellps=GRS80 rf=0
+expect failure
+
+operation proj=utm zone=32 ellps=GRS80 es=1
+expect failure
+
+operation proj=utm zone=32 ellps=GRS80 b=0
+expect failure
+
+operation proj=utm zone=32 ellps=GRS80 b=6000000
+accept 12 55
+expect 699293.0880 5674591.5295
+
+operation proj=utm zone=32 ellps=GRS80 rf=300
+accept 12 55
+expect 691873.1212 6099054.9661
+
+operation proj=utm zone=32 ellps=GRS80 f=0.00333333333333
+accept 12 55
+expect 691873.1212 6099054.9661
+
+operation proj=utm zone=32 ellps=GRS80 b=6000000
+accept 12 55
+expect 699293.0880 5674591.5295
+
+operation proj=utm zone=32 a=6400000 b=6000000
+accept 12 55
+expect 700416.5900 5669475.8884
+-------------------------------------------------------------------------------
+
END