diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-04-22 15:27:33 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-04-22 15:49:31 +0200 |
| commit | 1c677ed192125ddc0eb4b90b24b80d9820769dd0 (patch) | |
| tree | 2c393ce6cc1aba097e04603a452a0ef53f4a31ee /src | |
| parent | 3faaf339216f128be7a8bb354e858203e5ec6d7f (diff) | |
| download | PROJ-1c677ed192125ddc0eb4b90b24b80d9820769dd0.tar.gz PROJ-1c677ed192125ddc0eb4b90b24b80d9820769dd0.zip | |
Tweak morphNameToESRI() to reflect current ESRI practice regarding a few '(foo)' suffixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/io.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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 += '_'; } |
