aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-06-02 17:33:50 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-06-02 17:33:50 +0200
commit77de7651fdcb88c00de72f9cf16f6b0cc751670b (patch)
tree7a8e62262bc9f9e0188f40598f657b922e3a2adf
parentfdfeae1908e8bf9e199aed3654ff418aaaa4fe26 (diff)
downloadPROJ-77de7651fdcb88c00de72f9cf16f6b0cc751670b.tar.gz
PROJ-77de7651fdcb88c00de72f9cf16f6b0cc751670b.zip
proj_create(): do not open proj.db if string is a PROJ string, even if proj_context_set_autoclose_database() has been set (fixes #2734)
-rw-r--r--src/iso19111/io.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index a51a015f..ccbb0ffe 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -6944,7 +6944,12 @@ BaseObjectNNPtr createFromUserInput(const std::string &text, PJ_CONTEXT *ctx) {
DatabaseContextPtr dbContext;
try {
if (ctx != nullptr && ctx->cpp_context) {
- dbContext = ctx->cpp_context->getDatabaseContext().as_nullable();
+ // Only connect to proj.db if needed
+ if (text.find("proj=") == std::string::npos ||
+ text.find("init=") != std::string::npos) {
+ dbContext =
+ ctx->cpp_context->getDatabaseContext().as_nullable();
+ }
}
} catch (const std::exception &) {
}