diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2017-10-30 09:49:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-30 09:49:50 +0100 |
| commit | 2140bf936542bfaf655e33dfffa6fabb56a27f86 (patch) | |
| tree | 7b0ffa4f38dc05b6ec8a9d7bb70f698dc8610fe7 /src/PJ_vgridshift.c | |
| parent | aa3492b9043dbd070b1069ba30f4b12bb6abc1dd (diff) | |
| parent | 79b7d780c26c79b2171eea2798cc8c0dc0e0e3bc (diff) | |
| download | PROJ-2140bf936542bfaf655e33dfffa6fabb56a27f86.tar.gz PROJ-2140bf936542bfaf655e33dfffa6fabb56a27f86.zip | |
Merge pull request #588 from kbevers/kinematic-grids
Kinematic gridshifting
Diffstat (limited to 'src/PJ_vgridshift.c')
| -rw-r--r-- | src/PJ_vgridshift.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/PJ_vgridshift.c b/src/PJ_vgridshift.c index ededd544..691f791b 100644 --- a/src/PJ_vgridshift.c +++ b/src/PJ_vgridshift.c @@ -9,14 +9,10 @@ static XYZ forward_3d(LPZ lpz, PJ *P) { PJ_TRIPLET point; point.lpz = lpz; - if (P->gridlist != NULL) { + if (P->vgridlist_geoid != NULL) { /* Only try the gridshift if at least one grid is loaded, * otherwise just pass the coordinate through unchanged. */ - pj_apply_vgridshift( P, "sgrids", - &(P->gridlist), - &(P->gridlist_count), - 1, 1, 0, - &point.xyz.x, &point.xyz.y, &point.xyz.z ); + point.xyz.z -= proj_vgrid_value(P, point.lp); } return point.xyz; @@ -27,14 +23,10 @@ static LPZ reverse_3d(XYZ xyz, PJ *P) { PJ_TRIPLET point; point.xyz = xyz; - if (P->gridlist != NULL) { + if (P->vgridlist_geoid != NULL) { /* Only try the gridshift if at least one grid is loaded, * otherwise just pass the coordinate through unchanged. */ - pj_apply_vgridshift( P, "sgrids", - &(P->gridlist), - &(P->gridlist_count), - 0, 1, 0, - &point.xyz.x, &point.xyz.y, &point.xyz.z ); + point.xyz.z += proj_vgrid_value(P, point.lp); } return point.lpz; @@ -61,14 +53,13 @@ PJ *PROJECTION(vgridshift) { return pj_default_destructor(P, PJD_ERR_NO_ARGS); } - /* Build gridlist. P->gridlist can be empty if +grids only ask for optional grids. */ - P->gridlist = pj_gridlist_from_nadgrids( P->ctx, pj_param(P->ctx, P->params, "sgrids").s, - &(P->gridlist_count) ); + /* Build gridlist. P->vgridlist_geoid can be empty if +grids only ask for optional grids. */ + proj_vgrid_init(P, "grids"); /* Was gridlist compiled properly? */ - if ( pj_ctx_get_errno(P->ctx) ) { + if ( proj_errno(P) ) { proj_log_error(P, "vgridshift: could not find required grid(s)."); - return pj_default_destructor(P, -38); + return pj_default_destructor(P, PJD_ERR_FAILED_TO_LOAD_GRID); } P->fwdobs = forward_obs; |
