aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-06-21 23:44:53 +0200
committerEven Rouault <even.rouault@spatialys.com>2018-06-21 23:44:53 +0200
commit275cbbaca08864867e6e3c7bf199a38204d3fffe (patch)
treef3c9e4be7515f3b3e549678d2a7f1a694adeeae6
parent8ee389a6f44fb9ac0380ddbd3706b9354269d62f (diff)
downloadPROJ-275cbbaca08864867e6e3c7bf199a38204d3fffe.tar.gz
PROJ-275cbbaca08864867e6e3c7bf199a38204d3fffe.zip
Make +proj=geocent and +proj=cart take into account +to_meter (relates to #1053)
-rw-r--r--src/pj_fwd.c3
-rw-r--r--src/pj_inv.c6
-rw-r--r--test/gie/4D-API_cs2cs-style.gie15
3 files changed, 23 insertions, 1 deletions
diff --git a/src/pj_fwd.c b/src/pj_fwd.c
index b5f1b36e..2ed4c469 100644
--- a/src/pj_fwd.c
+++ b/src/pj_fwd.c
@@ -114,6 +114,9 @@ static PJ_COORD fwd_finalize (PJ *P, PJ_COORD coo) {
if (P->is_geocent) {
coo = proj_trans (P->cart, PJ_FWD, coo);
}
+ coo.xyz.x *= P->fr_meter;
+ coo.xyz.y *= P->fr_meter;
+ coo.xyz.z *= P->fr_meter;
break;
diff --git a/src/pj_inv.c b/src/pj_inv.c
index ca149674..d1a02bca 100644
--- a/src/pj_inv.c
+++ b/src/pj_inv.c
@@ -100,8 +100,12 @@ static PJ_COORD inv_prepare (PJ *P, PJ_COORD coo) {
/* de-scale and de-offset */
case PJ_IO_UNITS_CARTESIAN:
- if (P->is_geocent)
+ coo.xyz.x *= P->to_meter;
+ coo.xyz.y *= P->to_meter;
+ coo.xyz.z *= P->to_meter;
+ if (P->is_geocent) {
coo = proj_trans (P->cart, PJ_INV, coo);
+ }
return coo;
diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie
index f01d9352..a09f7168 100644
--- a/test/gie/4D-API_cs2cs-style.gie
+++ b/test/gie/4D-API_cs2cs-style.gie
@@ -309,4 +309,19 @@ accept 0.0 0.0 0.00
expect 3396190.0 0.0 0.0
roundtrip 1
+
+-------------------------------------------------------------------------------
+Check that geocent and cart take into account to_meter (#1053)
+-------------------------------------------------------------------------------
+
+operation +proj=geocent +a=1000 +b=1000 +to_meter=1000
+accept 90 0 0
+expect 0 1 0
+roundtrip 1
+
+operation +proj=cart +a=1000 +b=1000 +to_meter=1000
+accept 90 0 0
+expect 0 1 0
+roundtrip 1
+
</gie>