From d8526d7870e4b91238c9a7b652ed03c21b77e884 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 22 Apr 2019 13:15:02 +0200 Subject: ESRI_WKT: preserve Gauss_Kruger in conversion name for round-tripping --- src/iso19111/io.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/iso19111/io.cpp') diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 360d55a2..399908eb 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -3257,7 +3257,10 @@ ConversionNNPtr WKTParser::Private::buildProjectionFromESRI( } return Conversion::create( - PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"), + PropertyMap().set(IdentifiedObject::NAME_KEY, + esriProjectionName == "Gauss_Kruger" + ? "unnnamed (Gauss Kruger)" + : "unnamed"), propertiesMethod, parameters, values) ->identify(); } -- cgit v1.2.3 From 1c677ed192125ddc0eb4b90b24b80d9820769dd0 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 22 Apr 2019 15:27:33 +0200 Subject: Tweak morphNameToESRI() to reflect current ESRI practice regarding a few '(foo)' suffixes --- src/iso19111/io.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/iso19111/io.cpp') diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 399908eb..4a38a057 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -757,13 +757,22 @@ const std::string &WKTFormatter::getHDatumExtension() const { // --------------------------------------------------------------------------- std::string WKTFormatter::morphNameToESRI(const std::string &name) { + + for (const auto *suffix : {"(m)", "(ftUS)", "(E-N)", "(N-E)"}) { + if (ends_with(name, suffix)) { + return morphNameToESRI( + name.substr(0, name.size() - strlen(suffix))) + + suffix; + } + } + std::string ret; bool insertUnderscore = false; // Replace any special character by underscore, except at the beginning // and of the name where those characters are removed. for (char ch : name) { - if (ch == '+' || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z')) { + if (ch == '+' || ch == '-' || (ch >= '0' && ch <= '9') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { if (insertUnderscore && !ret.empty()) { ret += '_'; } -- cgit v1.2.3