aboutsummaryrefslogtreecommitdiff
path: root/src/proj_4D_api.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-03-21 03:45:39 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-03-21 10:51:53 +0100
commitcf6b060f5c3a96afc11e54e52ef2bfe0bab27991 (patch)
treeba6c0ded8a022bd0fdf74483ccb43513762033ae /src/proj_4D_api.c
parent60dc8062e06964fb44532cf353c9f3792d57aa68 (diff)
downloadPROJ-cf6b060f5c3a96afc11e54e52ef2bfe0bab27991.tar.gz
PROJ-cf6b060f5c3a96afc11e54e52ef2bfe0bab27991.zip
Take into account +towgs84=0,0,0 in pipeline to still imply geodetic->cartesian->geodetic (fixes #881)
Diffstat (limited to 'src/proj_4D_api.c')
-rw-r--r--src/proj_4D_api.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c
index 05f030e5..11a56ac0 100644
--- a/src/proj_4D_api.c
+++ b/src/proj_4D_api.c
@@ -419,6 +419,7 @@ Returns 1 on success, 0 on failure
**************************************************************************************/
PJ *Q;
paralist *p;
+ int do_cart = 0;
if (0==P)
return 0;
@@ -481,8 +482,14 @@ Returns 1 on success, 0 on failure
size_t n = strlen (s);
/* We ignore null helmert shifts (common in auto-translated resource files, e.g. epsg) */
- if (0==d[0] && 0==d[1] && 0==d[2] && 0==d[3] && 0==d[4] && 0==d[5] && 0==d[6])
+ if (0==d[0] && 0==d[1] && 0==d[2] && 0==d[3] && 0==d[4] && 0==d[5] && 0==d[6]) {
+ /* If the current ellipsoid is not WGS84, then make sure the */
+ /* change in ellipsoid is still done. */
+ if (!(fabs(P->a - 6378137.0) < 1e-8 && fabs(P->f - 1./ 298.257223563) < 1e-15)) {
+ do_cart = 1;
+ }
break;
+ }
if (n <= 8) /* 8==strlen ("towgs84=") */
return 0;
@@ -503,7 +510,7 @@ Returns 1 on success, 0 on failure
/* We also need cartesian/geographical transformations if we are working in */
/* geocentric/cartesian space or we need to do a Helmert transform. */
- if (P->is_geocent || P->helmert) {
+ if (P->is_geocent || P->helmert || do_cart) {
char def[150];
sprintf (def, "break_cs2cs_recursion proj=cart a=%40.20g f=%40.20g", P->a, P->f);
Q = proj_create (P->ctx, def);