aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 &) {
}