From b7e7a3bd4a85ce07cc9dee457f3c44be43950084 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 11 Sep 2019 13:55:17 +0000 Subject: Ingestion of +proj=somerc +type=crs: avoid adding twice alpha, gamma, lon_0 (related to #1597) --- src/iso19111/io.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/iso19111/io.cpp') diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 25d122af..e5cabd3d 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 && -- cgit v1.2.3 From 9e5807499c5a37d31f983cd58eb21c918daf1fef Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 11 Sep 2019 14:22:32 +0000 Subject: createFromPROJString(): ignore +no_defs when instanciating a '+init=epsg:xxxx +no_defs' string (related to #1597) --- src/iso19111/io.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/iso19111/io.cpp') diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index e5cabd3d..ebccf78b 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -8759,10 +8759,17 @@ PROJStringParser::createFromPROJString(const std::string &projString) { if (!file_found) { auto obj = createFromUserInput(stepName, d->dbContext_, true); auto crs = dynamic_cast(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() -- cgit v1.2.3