diff options
| author | Peter Townsend <38544371+mlptownsend@users.noreply.github.com> | 2021-11-12 06:39:20 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-12 13:39:20 +0100 |
| commit | ac882266b57d04720bb645b8144901127f7427cf (patch) | |
| tree | ff3e30f46124ca53d842e56d69f9447d934f3b67 /src/4D_api.cpp | |
| parent | ac113a8898cded7f5359f1edd3abc17a78eee9b4 (diff) | |
| download | PROJ-ac882266b57d04720bb645b8144901127f7427cf.tar.gz PROJ-ac882266b57d04720bb645b8144901127f7427cf.zip | |
Add new option to proj_create_crs_to_crs_from_pj method to force +over on transformation operations (#2914)
Fixes #2512
Diffstat (limited to 'src/4D_api.cpp')
| -rw-r--r-- | src/4D_api.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp index d366aba8..94458398 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -1843,6 +1843,7 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons const char* authority = nullptr; double accuracy = -1; bool allowBallparkTransformations = true; + bool forceOver = false; for (auto iter = options; iter && iter[0]; ++iter) { const char *value; if ((value = getOptionValue(*iter, "AUTHORITY="))) { @@ -1859,7 +1860,13 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons "Invalid value for ALLOW_BALLPARK option."); return nullptr; } - } else { + } + else if ((value = getOptionValue(*iter, "FORCE_OVER="))) { + if (ci_equal(value, "yes")) { + forceOver = true; + } + } + else { std::string msg("Unknown option :"); msg += *iter; ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, msg.c_str()); @@ -1913,6 +1920,8 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons return nullptr; } + ctx->forceOver = forceOver; + PJ* P = proj_list_get(ctx, op_list, 0); assert(P); @@ -1920,11 +1929,14 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons proj_get_type(source_crs) == PJ_TYPE_GEOCENTRIC_CRS || proj_get_type(target_crs) == PJ_TYPE_GEOCENTRIC_CRS ) { proj_list_destroy(op_list); + ctx->forceOver = false; return P; } auto preparedOpList = pj_create_prepared_operations(ctx, source_crs, target_crs, op_list); + + ctx->forceOver = false; proj_list_destroy(op_list); if( preparedOpList.empty() ) |
