diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/4D_api.cpp | 14 | ||||
| -rw-r--r-- | src/init.cpp | 3 | ||||
| -rw-r--r-- | src/proj_internal.h | 1 |
3 files changed, 17 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() ) diff --git a/src/init.cpp b/src/init.cpp index 61457cb6..b45c1128 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -589,6 +589,9 @@ pj_init_ctx_with_allow_init_epsg(PJ_CONTEXT *ctx, int argc, char **argv, int all /* Over-ranging flag */ PIN->over = pj_param(ctx, start, "bover").i; + if (ctx->forceOver) { + PIN->over = ctx->forceOver; + } /* Vertical datum geoid grids */ PIN->has_geoid_vgrids = pj_param(ctx, start, "tgeoidgrids").i; diff --git a/src/proj_internal.h b/src/proj_internal.h index 6edb6aec..330869e0 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -683,6 +683,7 @@ struct pj_ctx{ void *logger_app_data = nullptr; struct projCppContext* cpp_context = nullptr; /* internal context for C++ code */ int use_proj4_init_rules = -1; /* -1 = unknown, 0 = no, 1 = yes */ + bool forceOver = false; int epsg_file_exists = -1; /* -1 = unknown, 0 = no, 1 = yes */ std::string ca_bundle_path{}; |
