Skip to content

Commit

Permalink
Merge pull request #743 from kbevers/fix-nullgrid-datumtransform
Browse files Browse the repository at this point in the history
Handle ellipsoid parameters correctly when using +nadgrids=@null.
  • Loading branch information
kbevers committed Jan 23, 2018
2 parents 33a7216 + d0dbf48 commit 29cb4a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 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.243 0.000
600000.0000 2600545.4523 0.0000 652760.737 7033791.244 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.191 0.000
600000.0000 2200000.0000 0.0000 649398.872 6633524.192 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.016 0.000
1203792.5981 626873.17210 0.0000 1238875.764 5057405.017 0.000
+init=./IGNF:LAMBE +to +init=./IGNF:GEOPORTALFXX
600000.0000 2600545.4523 0.0000 179040.148 5610495.275 0.000
600000.0000 2600545.4523 0.0000 179040.148 5610495.276 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.607
3356123.5400 1303218.3090 5247430.6050 3353421.833 1304074.314 5248935.606
21 changes: 17 additions & 4 deletions src/pj_transform.c
Expand Up @@ -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;
}
}

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

0 comments on commit 29cb4a0

Please sign in to comment.