From 60b08570aa47be15bf5e41745a0a00c22304c41d Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Tue, 20 Mar 2018 21:47:48 +0100 Subject: Introduce late expansion of +datum parameters. Fixes #872. --- src/pj_init.c | 9 ++++++--- test/gie/4D-API_cs2cs-style.gie | 13 +++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/pj_init.c b/src/pj_init.c index 2d549317..e5b1441a 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -590,9 +590,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); diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie index 0710edde..7b5f2958 100644 --- a/test/gie/4D-API_cs2cs-style.gie +++ b/test/gie/4D-API_cs2cs-style.gie @@ -215,5 +215,18 @@ 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 +------------------------------------------------------------------------------- + -- cgit v1.2.3