diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-01-22 21:06:23 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-01-23 10:13:48 +0100 |
| commit | d0dbf48438f9e152314abf294467cb54f9ae0e70 (patch) | |
| tree | 321868fb1aca3d0e032219408986afa50cb6bac1 /src | |
| parent | 33a7216aea7bacf8cff72a5e6bb59b25e7d931f7 (diff) | |
| download | PROJ-d0dbf48438f9e152314abf294467cb54f9ae0e70.tar.gz PROJ-d0dbf48438f9e152314abf294467cb54f9ae0e70.zip | |
Handle ellipsoid parameters correctly when using +nadgrids=@null. Fixes #22.
Make sure to not change ellipsoid parameters to WGS84 when applying the
null grid. Coordinates will still refer to the input ellipsoid so we
keep the original parameters which in turn will be used when the
coordinates are transformated to/from cartesian/geocentric space.
Adjusted regression test material in nad/proj_outIGNF.dist slightly to
accomodate numerical differences at the mm level. The transformations
in question are at best accurate to about 1m so this shouldn't change
real world usage of these transformations.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pj_transform.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/pj_transform.c b/src/pj_transform.c index c72df2e7..6ad227cd 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -748,17 +748,30 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, /* -------------------------------------------------------------------- */ if( srcdefn->datum_type == PJD_GRIDSHIFT ) { + const char* srcnadgrids = pj_param(srcdefn->ctx, srcdefn->params,"snadgrids").s; + pj_apply_gridshift_2( srcdefn, 0, point_count, point_offset, x, y, z ); CHECK_RETURN(srcdefn); - src_a = SRS_WGS84_SEMIMAJOR; - src_es = SRS_WGS84_ESQUARED; + /* If the gridlist has either "@null" or "null" as its only */ + /* grid we don't change the ellipsoid parameters, since the */ + /* datum shift to WGS84 was not performed in practice. */ + if ( strcmp("@null", srcnadgrids) && strcmp("null", srcnadgrids) ) { + src_a = SRS_WGS84_SEMIMAJOR; + src_es = SRS_WGS84_ESQUARED; + } } if( dstdefn->datum_type == PJD_GRIDSHIFT ) { - dst_a = SRS_WGS84_SEMIMAJOR; - dst_es = SRS_WGS84_ESQUARED; + const char* dstnadgrids = pj_param(dstdefn->ctx, dstdefn->params,"snadgrids").s; + /* If the gridlist has either "@null" or "null" as its only */ + /* grid we don't change the ellipsoid parameters, since the */ + /* datum shift to WGS84 will not be performed. */ + if ( strcmp("@null", dstnadgrids) && strcmp("null", dstnadgrids) ) { + dst_a = SRS_WGS84_SEMIMAJOR; + dst_es = SRS_WGS84_ESQUARED; + } } /* ==================================================================== */ |
