From 77de7651fdcb88c00de72f9cf16f6b0cc751670b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 2 Jun 2021 17:33:50 +0200 Subject: 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) --- src/iso19111/io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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 &) { } -- cgit v1.2.3