aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-15 22:38:14 +0200
committerGitHub <noreply@github.com>2019-09-15 22:38:14 +0200
commit1aaca77c2aa548a7be16fc2a2a00a5ef8e867e2a (patch)
tree03bb1cb4a1b33b83ec18ef476be4e19180195b43 /src
parenteb5906bb14afba3a5a5508314cfcaa661b75d29d (diff)
parent73042b0139ccbdb86996c653b179746e5bc4de67 (diff)
downloadPROJ-1aaca77c2aa548a7be16fc2a2a00a5ef8e867e2a.tar.gz
PROJ-1aaca77c2aa548a7be16fc2a2a00a5ef8e867e2a.zip
Merge pull request #1616 from OSGeo/backport-1614-to-6.2
[Backport 6.2] Fixes related to #1597
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/factory.cpp2
-rw-r--r--src/iso19111/io.cpp26
2 files changed, 20 insertions, 8 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index 0f6790c0..60083455 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -1000,9 +1000,11 @@ bool DatabaseContext::lookForGridInfo(const std::string &projFilename,
if (d->pjCtxt() == nullptr) {
d->setPjCtxt(pj_get_default_ctx());
}
+ int errno_before = proj_context_errno(d->pjCtxt());
gridAvailable =
pj_find_file(d->pjCtxt(), projFilename.c_str(), &fullFilename[0],
fullFilename.size() - 1) != 0;
+ proj_context_errno_set(d->pjCtxt(), errno_before);
fullFilename.resize(strlen(fullFilename.c_str()));
auto res =
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 25d122af..ebccf78b 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -8313,10 +8313,13 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS(
} else if (step.name == "somerc") {
mapping =
getMapping(EPSG_CODE_METHOD_HOTINE_OBLIQUE_MERCATOR_VARIANT_B);
- step.paramValues.emplace_back(Step::KeyValue("alpha", "90"));
- step.paramValues.emplace_back(Step::KeyValue("gamma", "90"));
- step.paramValues.emplace_back(
- Step::KeyValue("lonc", getParamValue(step, "lon_0")));
+ if (!hasParamValue(step, "alpha") && !hasParamValue(step, "gamma") &&
+ !hasParamValue(step, "lonc")) {
+ step.paramValues.emplace_back(Step::KeyValue("alpha", "90"));
+ step.paramValues.emplace_back(Step::KeyValue("gamma", "90"));
+ step.paramValues.emplace_back(
+ Step::KeyValue("lonc", getParamValue(step, "lon_0")));
+ }
} else if (step.name == "krovak" &&
((getParamValue(step, "axis") == "swu" && iAxisSwap < 0) ||
(iAxisSwap > 0 &&
@@ -8756,10 +8759,17 @@ PROJStringParser::createFromPROJString(const std::string &projString) {
if (!file_found) {
auto obj = createFromUserInput(stepName, d->dbContext_, true);
auto crs = dynamic_cast<CRS *>(obj.get());
- if (crs &&
- (d->steps_[0].paramValues.empty() ||
- (d->steps_[0].paramValues.size() == 1 &&
- d->getParamValue(d->steps_[0], "type") == "crs"))) {
+
+ bool hasSignificantParamValues = false;
+ for (const auto &kv : d->steps_[0].paramValues) {
+ if (!((kv.key == "type" && kv.value == "crs") ||
+ kv.key == "no_defs")) {
+ hasSignificantParamValues = true;
+ break;
+ }
+ }
+
+ if (crs && !hasSignificantParamValues) {
PropertyMap properties;
properties.set(IdentifiedObject::NAME_KEY,
d->title_.empty() ? crs->nameStr()