diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-09-16 12:01:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-16 12:01:39 +0200 |
| commit | a3e412995df7dae2c8ef13d2682e03b770edcb75 (patch) | |
| tree | 751cd21521ee33e002222b165c1938990d1b0bac /src/iso19111/datum.cpp | |
| parent | e54739954db813cd8394066b1e64ae8f2dd76bd8 (diff) | |
| parent | 85f496b26702bf6566296072795e821d70156c09 (diff) | |
| download | PROJ-a3e412995df7dae2c8ef13d2682e03b770edcb75.tar.gz PROJ-a3e412995df7dae2c8ef13d2682e03b770edcb75.zip | |
Merge pull request #2851 from rouault/epsg_10_035
Database: update to EPSG v10.035
Diffstat (limited to 'src/iso19111/datum.cpp')
| -rw-r--r-- | src/iso19111/datum.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/iso19111/datum.cpp b/src/iso19111/datum.cpp index 96952866..ebef94a2 100644 --- a/src/iso19111/datum.cpp +++ b/src/iso19111/datum.cpp @@ -1401,17 +1401,32 @@ bool GeodeticReferenceFrame::hasEquivalentNameToUsingAlias( if (dbContext) { if (!identifiers().empty()) { const auto &id = identifiers().front(); - auto aliasesResult = + + const std::string officialNameFromId = dbContext->getName( + "geodetic_datum", *(id->codeSpace()), id->code()); + const auto aliasesResult = dbContext->getAliases(*(id->codeSpace()), id->code(), nameStr(), "geodetic_datum", std::string()); - const char *otherName = other->nameStr().c_str(); - for (const auto &aliasResult : aliasesResult) { - if (metadata::Identifier::isEquivalentName( - otherName, aliasResult.c_str())) { - return true; - } - } - return false; + + const auto isNameMatching = + [&aliasesResult, &officialNameFromId](const std::string &name) { + const char *nameCstr = name.c_str(); + if (metadata::Identifier::isEquivalentName( + nameCstr, officialNameFromId.c_str())) { + return true; + } else { + for (const auto &aliasResult : aliasesResult) { + if (metadata::Identifier::isEquivalentName( + nameCstr, aliasResult.c_str())) { + return true; + } + } + } + return false; + }; + + return isNameMatching(nameStr()) && + isNameMatching(other->nameStr()); } else if (!other->identifiers().empty()) { auto otherGRF = dynamic_cast<const GeodeticReferenceFrame *>(other); if (otherGRF) { |
