Skip to content

Commit

Permalink
Introduce late expansion of +datum parameters. Fixes #872.
Browse files Browse the repository at this point in the history
  • Loading branch information
kbevers committed Mar 20, 2018
1 parent 8e0c5db commit 35a2b5c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pj_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,12 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
PIN->vgridlist_geoid = NULL;
PIN->vgridlist_geoid_count = 0;

/* Set datum parameters */
if (pj_datum_set(ctx, start, PIN))
return pj_default_destructor (PIN, proj_errno(PIN));
/* Set datum parameters. Similarly to +init parameters we want to expand */
/* +datum parameters as late as possible when dealing with pipelines. */
/* otherwise only the first occurrence of +datum will be expanded and that */
if (n_pipelines == 0)
if (pj_datum_set(ctx, start, PIN))
return pj_default_destructor (PIN, proj_errno(PIN));

err = pj_ellipsoid (PIN);

Expand Down
13 changes: 13 additions & 0 deletions test/gie/4D-API_cs2cs-style.gie
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,17 @@ accept 487147.594520173 4934316.46263998 0
expect -10370728.80 5552839.74 0
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Test that +datum parameters are handled correctly in pipelines.
See #872 for details.
-------------------------------------------------------------------------------
operation +proj=pipeline
+step +proj=longlat +datum=NAD27 +inv
+step +proj=longlat +datum=WGS84
-------------------------------------------------------------------------------
tolerance 20 cm
accept -100 40 0
expect -100.0004058367 40.0000058947 0.0000
-------------------------------------------------------------------------------

</gie>

0 comments on commit 35a2b5c

Please sign in to comment.