Skip to content

Commit

Permalink
Revert fix to #22
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kbevers committed Mar 1, 2018
1 parent 29874b8 commit f41fad3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
10 changes: 5 additions & 5 deletions nad/proj_outIGNF.dist
@@ -1,16 +1,16 @@
+init=./IGNF:NTFG +to +init=./IGNF:RGF93G
3.300866856 43.4477976569 0.0000 3d18'0.915"E 43d26'52.077"N 0.000
+init=./IGNF:LAMBE +to +init=./IGNF:LAMB93
600000.0000 2600545.4523 0.0000 652760.737 7033791.244 0.000
600000.0000 2600545.4523 0.0000 652760.737 7033791.243 0.000
135638.3592 2418760.4094 0.0000 187194.062 6855928.882 0.000
998137.3947 2413822.2844 0.0000 1049052.258 6843776.562 0.000
600000.0000 2200000.0000 0.0000 649398.872 6633524.192 0.000
600000.0000 2200000.0000 0.0000 649398.872 6633524.191 0.000
311552.5340 1906457.4840 0.0000 358799.172 6342652.486 0.000
960488.4138 1910172.8812 0.0000 1007068.686 6340907.237 0.000
600000.0000 1699510.8340 0.0000 645204.279 6133556.746 0.000
1203792.5981 626873.17210 0.0000 1238875.764 5057405.017 0.000
1203792.5981 626873.17210 0.0000 1238875.764 5057405.016 0.000
+init=./IGNF:LAMBE +to +init=./IGNF:GEOPORTALFXX
600000.0000 2600545.4523 0.0000 179040.148 5610495.276 0.000
600000.0000 2600545.4523 0.0000 179040.148 5610495.275 0.000
135638.3592 2418760.4094 0.0000 -303729.363 5410118.356 0.000
998137.3947 2413822.2844 0.0000 592842.792 5410120.554 0.000
600000.0000 2200000.0000 0.0000 179041.670 5209746.080 0.000
Expand All @@ -37,4 +37,4 @@
2d20'11.7754730" 42d18'00.0824436" 0.0 260109.601 5009175.714 0.000
9d32'12.6680218" 41d24'00.3542556" 0.0 1061637.534 4889066.592 0.000
+init=./IGNF:RGR92 +to +init=./IGNF:REUN47
3356123.5400 1303218.3090 5247430.6050 3353421.833 1304074.314 5248935.606
3356123.5400 1303218.3090 5247430.6050 3353421.833 1304074.314 5248935.607
23 changes: 4 additions & 19 deletions src/pj_transform.c
Expand Up @@ -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;
}

/* ==================================================================== */
Expand Down

0 comments on commit f41fad3

Please sign in to comment.