diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-03-21 15:35:17 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-03-21 15:35:17 +0100 |
| commit | cfbfea466ed4782be112809a8984a62f14224a5a (patch) | |
| tree | c675791e758864c6871ff8171b86a35cd70f6975 | |
| parent | 4b65baf477607df77101abd165eb110b53d80754 (diff) | |
| parent | d42b48479baf2f217d7d1d347f2626f347125bca (diff) | |
| download | PROJ-cfbfea466ed4782be112809a8984a62f14224a5a.tar.gz PROJ-cfbfea466ed4782be112809a8984a62f14224a5a.zip | |
Merge branch '5.0' of https://github.com/OSGeo/proj.4 into 5.0
| -rw-r--r-- | src/pj_fwd.c | 10 | ||||
| -rw-r--r-- | src/pj_gridinfo.c | 22 | ||||
| -rw-r--r-- | src/pj_inv.c | 10 | ||||
| -rw-r--r-- | src/proj_4D_api.c | 11 | ||||
| -rw-r--r-- | test/gie/4D-API_cs2cs-style.gie | 14 | ||||
| -rw-r--r-- | test/gigs/5111.1.gie | 2 |
6 files changed, 51 insertions, 18 deletions
diff --git a/src/pj_fwd.c b/src/pj_fwd.c index ef05962d..2a064e58 100644 --- a/src/pj_fwd.c +++ b/src/pj_fwd.c @@ -71,9 +71,10 @@ static PJ_COORD fwd_prepare (PJ *P, PJ_COORD coo) { if (P->hgridshift) coo = proj_trans (P->hgridshift, PJ_INV, coo); - else if (P->helmert) { + else if (P->helmert || (P->cart_wgs84 != 0 && P->cart != 0)) { coo = proj_trans (P->cart_wgs84, PJ_FWD, coo); /* Go cartesian in WGS84 frame */ - coo = proj_trans (P->helmert, PJ_INV, coo); /* Step into local frame */ + if( P->helmert ) + coo = proj_trans (P->helmert, PJ_INV, coo); /* Step into local frame */ coo = proj_trans (P->cart, PJ_INV, coo); /* Go back to angular using local ellps */ } if (coo.lp.lam==HUGE_VAL) @@ -146,9 +147,10 @@ static PJ_COORD fwd_finalize (PJ *P, PJ_COORD coo) { return coo; if (P->hgridshift) coo = proj_trans (P->hgridshift, PJ_INV, coo); - else if (P->helmert) { + else if (P->helmert || (P->cart_wgs84 != 0 && P->cart != 0)) { coo = proj_trans (P->cart_wgs84, PJ_FWD, coo); /* Go cartesian in WGS84 frame */ - coo = proj_trans (P->helmert, PJ_INV, coo); /* Step into local frame */ + if( P->helmert ) + coo = proj_trans (P->helmert, PJ_INV, coo); /* Step into local frame */ coo = proj_trans (P->cart, PJ_INV, coo); /* Go back to angular using local ellps */ } if (coo.lp.lam==HUGE_VAL) diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c index ba440de4..978e19d7 100644 --- a/src/pj_gridinfo.c +++ b/src/pj_gridinfo.c @@ -923,13 +923,21 @@ PJ_GRIDINFO *pj_gridinfo_init( projCtx ctx, const char *gridname ) gilist->format = "ctable2"; gilist->ct = ct; - pj_log( ctx, PJ_LOG_DEBUG_MAJOR, - "Ctable2 %s %dx%d: LL=(%.9g,%.9g) UR=(%.9g,%.9g)\n", - ct->id, - ct->lim.lam, ct->lim.phi, - ct->ll.lam * RAD_TO_DEG, ct->ll.phi * RAD_TO_DEG, - (ct->ll.lam + (ct->lim.lam-1)*ct->del.lam) * RAD_TO_DEG, - (ct->ll.phi + (ct->lim.phi-1)*ct->del.phi) * RAD_TO_DEG ); + if (ct == NULL) + { + pj_log( ctx, PJ_LOG_DEBUG_MAJOR, + "CTABLE V2 ct is NULL."); + } + else + { + pj_log( ctx, PJ_LOG_DEBUG_MAJOR, + "Ctable2 %s %dx%d: LL=(%.9g,%.9g) UR=(%.9g,%.9g)", + ct->id, + ct->lim.lam, ct->lim.phi, + ct->ll.lam * RAD_TO_DEG, ct->ll.phi * RAD_TO_DEG, + (ct->ll.lam + (ct->lim.lam-1)*ct->del.lam) * RAD_TO_DEG, + (ct->ll.phi + (ct->lim.phi-1)*ct->del.phi) * RAD_TO_DEG ); + } } else diff --git a/src/pj_inv.c b/src/pj_inv.c index f2901ca0..24a87e9f 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -78,9 +78,10 @@ static PJ_COORD inv_prepare (PJ *P, PJ_COORD coo) { if (P->hgridshift) coo = proj_trans (P->hgridshift, PJ_FWD, coo); - else if (P->helmert) { + else if (P->helmert || (P->cart_wgs84 != 0 && P->cart != 0)) { coo = proj_trans (P->cart, PJ_FWD, coo); /* Go cartesian in local frame */ - coo = proj_trans (P->helmert, PJ_FWD, coo); /* Step into WGS84 */ + if( P->helmert ) + coo = proj_trans (P->helmert, PJ_FWD, coo); /* Step into WGS84 */ coo = proj_trans (P->cart_wgs84, PJ_INV, coo); /* Go back to angular using WGS84 ellps */ } if (coo.lp.lam==HUGE_VAL) @@ -154,9 +155,10 @@ static PJ_COORD inv_finalize (PJ *P, PJ_COORD coo) { return coo; if (P->hgridshift) coo = proj_trans (P->hgridshift, PJ_FWD, coo); - else if (P->helmert) { + else if (P->helmert || (P->cart_wgs84 != 0 && P->cart != 0)) { coo = proj_trans (P->cart, PJ_FWD, coo); /* Go cartesian in local frame */ - coo = proj_trans (P->helmert, PJ_FWD, coo); /* Step into WGS84 */ + if( P->helmert ) + coo = proj_trans (P->helmert, PJ_FWD, coo); /* Step into WGS84 */ coo = proj_trans (P->cart_wgs84, PJ_INV, coo); /* Go back to angular using WGS84 ellps */ } if (coo.lp.lam==HUGE_VAL) diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c index 6bb0760a..ef1b7915 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); diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie index 37f223b7..8e5fa069 100644 --- a/test/gie/4D-API_cs2cs-style.gie +++ b/test/gie/4D-API_cs2cs-style.gie @@ -227,4 +227,18 @@ accept -100 40 0 expect -100.0004058367 40.0000058947 0.0000 ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +Test that +towgs84=0,0,0 parameter is handled as still implying cart +transformation +------------------------------------------------------------------------------- +operation +proj=pipeline + +step +proj=utm +zone=11 +ellps=clrk66 +towgs84=0,0,0 +inv + +step +proj=utm +zone=11 +datum=WGS84 + +------------------------------------------------------------------------------- +tolerance 20 cm +accept 440720 3751320 0 +expect 440719.958709357 3751294.2109841 -4.44340920541435 +------------------------------------------------------------------------------- + </gie> diff --git a/test/gigs/5111.1.gie b/test/gigs/5111.1.gie index 335e1d68..d146b36a 100644 --- a/test/gigs/5111.1.gie +++ b/test/gigs/5111.1.gie @@ -21,7 +21,7 @@ tolerance 0.05 m accept 100.0876483 77.6534822 expect 2800000.0 15000000.0 -tolerance 0.05 m +tolerance 0.055 m accept 100.0876483 73.1442856 expect 2800000.0 13000000.0 |
