diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2019-09-15 16:28:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-15 16:28:36 +0200 |
| commit | 3c0a5f0c147556f3badbef940fe5e415ff6f5708 (patch) | |
| tree | e7f1cbaa5c7c218b81431280d0b27d004a7f4192 /src | |
| parent | 16ce294aa5246a94e07bad554b007dd8423e5780 (diff) | |
| parent | 6832bab5bf2ab2f13265fad52456e9a17560b06f (diff) | |
| download | PROJ-3c0a5f0c147556f3badbef940fe5e415ff6f5708.tar.gz PROJ-3c0a5f0c147556f3badbef940fe5e415ff6f5708.zip | |
Merge pull request #1614 from rouault/fixes_related_to_1597
Fixes related to #1597
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/factory.cpp | 2 | ||||
| -rw-r--r-- | src/iso19111/io.cpp | 26 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index 3ed69ae9..9ecc0906 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 7194a838..550312d8 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() |
