From f41fad3ac2bff401456f31dd3273e163ea7d09af Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Thu, 1 Mar 2018 12:04:06 +0100 Subject: Revert fix to #22 The fix in #22 solved the problem at hand and doing what was expected from the specified parameters. Unfortunately it also removed the slightly hacky "feature" that makes the web mercator work in pj_transform. The web mercator is special since the latitude is computed on the ellipsoid, but behaves as if if was defined on a sphere. Hence it is problematic to change the ellipsoid parameters when using the web mercator, even though that is the geodetically correct thing to do. The web mercator is used in more or less any web mapping application and is thus one of the most frequently used transformations in PROJ. This justifies re-introducing the minor bug reported in #22. The problem will have to be taken care of properly when pj_transform is removed from the library in favour of the transformation pipelines based API. --- src/pj_transform.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/pj_transform.c b/src/pj_transform.c index fc0a3241..c72df2e7 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -748,32 +748,17 @@ 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); - /* 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 ( srcnadgrids != NULL && - strcmp("@null", srcnadgrids) && strcmp("null", srcnadgrids) ) { - src_a = SRS_WGS84_SEMIMAJOR; - src_es = SRS_WGS84_ESQUARED; - } + src_a = SRS_WGS84_SEMIMAJOR; + src_es = SRS_WGS84_ESQUARED; } if( dstdefn->datum_type == PJD_GRIDSHIFT ) { - 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 ( dstnadgrids != NULL && - strcmp("@null", dstnadgrids) && strcmp("null", dstnadgrids) ) { - dst_a = SRS_WGS84_SEMIMAJOR; - dst_es = SRS_WGS84_ESQUARED; - } + dst_a = SRS_WGS84_SEMIMAJOR; + dst_es = SRS_WGS84_ESQUARED; } /* ==================================================================== */ -- cgit v1.2.3