diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 18:30:50 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 18:30:50 +0100 |
| commit | 37755e4edc53e09286cd2bb962299d0f5118fc77 (patch) | |
| tree | 8775122e8344ea9cb453b3c90f7fa782abb12ff3 /src/4D_api.cpp | |
| parent | e5706305795ed822a5197bda51e75a44ec14728b (diff) | |
| download | PROJ-37755e4edc53e09286cd2bb962299d0f5118fc77.tar.gz PROJ-37755e4edc53e09286cd2bb962299d0f5118fc77.zip | |
proj_create_crs_to_crs_from_pj(): add ACCURACY and ALLOW_BALLPARK options
Diffstat (limited to 'src/4D_api.cpp')
| -rw-r--r-- | src/4D_api.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 7423240f..909c3c32 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -1302,10 +1302,24 @@ 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; for (auto iter = options; iter && iter[0]; ++iter) { const char *value; if ((value = getOptionValue(*iter, "AUTHORITY="))) { authority = value; + } else if ((value = getOptionValue(*iter, "ACCURACY="))) { + accuracy = pj_atof(value); + } else if ((value = getOptionValue(*iter, "ALLOW_BALLPARK="))) { + if( ci_equal(value, "yes") ) + allowBallparkTransformations = true; + else if( ci_equal(value, "no") ) + allowBallparkTransformations = false; + else { + ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, + "Invalid value for ALLOW_BALLPARK option."); + return nullptr; + } } else { std::string msg("Unknown option :"); msg += *iter; @@ -1319,6 +1333,14 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons return nullptr; } + proj_operation_factory_context_set_allow_ballpark_transformations( + ctx, operation_ctx, allowBallparkTransformations); + + if( accuracy >= 0 ) { + proj_operation_factory_context_set_desired_accuracy(ctx, operation_ctx, + accuracy); + } + if( area && area->bbox_set ) { proj_operation_factory_context_set_area_of_interest( ctx, |
