diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-10-21 11:41:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-21 11:41:51 +0200 |
| commit | b61a1d0575791173bbcc9c61f8c19acd52e1162f (patch) | |
| tree | 87825317534c3d41159ea56497bf053f8b240e61 /src/apps | |
| parent | 6b8ef545c4200180cc1b4bf7179d0b0951029ae5 (diff) | |
| parent | 31f272708eaba9274b4b3c02240e9e7012c6b2b8 (diff) | |
| download | PROJ-b61a1d0575791173bbcc9c61f8c19acd52e1162f.tar.gz PROJ-b61a1d0575791173bbcc9c61f8c19acd52e1162f.zip | |
Merge pull request #2386 from rouault/improve_compoundcrs_identification
Improve CompoundCRS identification and name morphing in VerticalCRS with ESRI WKT1
Diffstat (limited to 'src/apps')
| -rw-r--r-- | src/apps/projinfo.cpp | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index e8c97576..37b76346 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -1198,26 +1198,48 @@ int main(int argc, char **argv) { std::cout << *ids[0]->codeSpace() << ":" << ids[0]->code() << ": " << pair.second << " %" << std::endl; - } else { - auto boundCRS = dynamic_cast<BoundCRS *>( - identifiedCRS.get()); - if (boundCRS && - !boundCRS->baseCRS() - ->identifiers() - .empty()) { - const auto &idsBase = - boundCRS->baseCRS()->identifiers(); - std::cout << "BoundCRS of " - << *idsBase[0]->codeSpace() << ":" - << idsBase[0]->code() << ": " - << pair.second << " %" - << std::endl; - } else { - std::cout - << "un-identifier CRS: " << pair.second - << " %" << std::endl; + continue; + } + + auto boundCRS = + dynamic_cast<BoundCRS *>(identifiedCRS.get()); + if (boundCRS && + !boundCRS->baseCRS()->identifiers().empty()) { + const auto &idsBase = + boundCRS->baseCRS()->identifiers(); + std::cout << "BoundCRS of " + << *idsBase[0]->codeSpace() << ":" + << idsBase[0]->code() << ": " + << pair.second << " %" << std::endl; + continue; + } + + auto compoundCRS = dynamic_cast<CompoundCRS *>( + identifiedCRS.get()); + if (compoundCRS) { + const auto &components = + compoundCRS->componentReferenceSystems(); + if (components.size() == 2 && + !components[0]->identifiers().empty() && + !components[1]->identifiers().empty()) { + const auto &idH = + components[0]->identifiers().front(); + const auto &idV = + components[1]->identifiers().front(); + if (*idH->codeSpace() == + *idV->codeSpace()) { + std::cout << *idH->codeSpace() << ":" + << idH->code() << '+' + << idV->code() << ": " + << pair.second << " %" + << std::endl; + continue; + } } } + + std::cout << "un-identified CRS: " << pair.second + << " %" << std::endl; } } catch (const std::exception &e) { std::cerr << "Identification failed: " << e.what() |
