diff --git a/src/ctx.cpp b/src/ctx.cpp index 622a814d9f..bcb6e1ccfb 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -60,6 +60,14 @@ void pj_set_ctx( projPJ pj, projCtx ctx ) if (pj==nullptr) return; pj->ctx = ctx; + if( pj->is_pipeline ) + { + pj_pipeline_assign_context_to_steps(pj, ctx); + } + for( const auto &alt: pj->alternativeCoordinateOperations ) + { + pj_set_ctx(alt.pj, ctx); + } } /************************************************************************/ diff --git a/src/pipeline.cpp b/src/pipeline.cpp index afa3b19aed..5f4d95633e 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -136,7 +136,11 @@ static PJ_LPZ pipeline_reverse_3d (PJ_XYZ xyz, PJ *P); static PJ_XY pipeline_forward (PJ_LP lp, PJ *P); static PJ_LP pipeline_reverse (PJ_XY xy, PJ *P); - +void pj_pipeline_assign_context_to_steps( PJ* P, PJ_CONTEXT* ctx ) +{ + for (int i = 1; i <= static_cast(P->opaque)->steps; i++) + proj_assign_context(static_cast(P->opaque)->pipeline[i], ctx); +} static PJ_COORD pipeline_forward_4d (PJ_COORD point, PJ *P) { diff --git a/src/proj_internal.h b/src/proj_internal.h index 4a126e98e6..77c4ba172d 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -926,6 +926,8 @@ std::string pj_double_quote_string_param_if_needed(const std::string& str); PJ *pj_create_internal (PJ_CONTEXT *ctx, const char *definition); PJ *pj_create_argv_internal (PJ_CONTEXT *ctx, int argc, char **argv); +void pj_pipeline_assign_context_to_steps( PJ* P, PJ_CONTEXT* ctx ); + /* classic public API */ #include "proj_api.h"