diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-03-25 12:44:05 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-03-25 13:05:40 +0100 |
| commit | 46f08f1434f66a4160d7c74923efcfb81505b398 (patch) | |
| tree | 680c623c5eee0978cf03e2f6475995d1e8cd52d0 /src | |
| parent | d4fd50f10ecabb9e9642cb4f877262e082677be4 (diff) | |
| download | PROJ-46f08f1434f66a4160d7c74923efcfb81505b398.tar.gz PROJ-46f08f1434f66a4160d7c74923efcfb81505b398.zip | |
WKT2_2018: always export ID in base crs node, even if there is one on upper node
This is a particular logic allowed by paragraph 7.3.3 Identifier
of OGC 18-010r6
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/crs.cpp | 6 | ||||
| -rw-r--r-- | src/iso19111/io.cpp | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 9779d817..2dc6b3bf 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -2432,7 +2432,8 @@ void DerivedCRS::baseExportToWKT(io::WKTFormatter *formatter, !l_baseCRS->identifiers().empty()); formatter->addQuotedString(l_baseCRS->nameStr()); l_baseCRS->exportDatumOrDatumEnsembleToWkt(formatter); - if (formatter->use2018Keywords() && formatter->outputId()) { + if (formatter->use2018Keywords() && + !(formatter->idOnTopLevelOnly() && formatter->topLevelHasId())) { l_baseCRS->formatID(formatter); } formatter->endNode(); @@ -2673,7 +2674,8 @@ void ProjectedCRS::_exportToWKT(io::WKTFormatter *formatter) const { geodeticCRSAxisList[0]->unit()._exportToWKT(formatter); } l_baseCRS->primeMeridian()->_exportToWKT(formatter); - if (formatter->use2018Keywords() && formatter->outputId()) { + if (formatter->use2018Keywords() && + !(formatter->idOnTopLevelOnly() && formatter->topLevelHasId())) { l_baseCRS->formatID(formatter); } formatter->endNode(); diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 220ee967..78b18719 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -634,6 +634,18 @@ bool WKTFormatter::primeMeridianInDegree() const { // --------------------------------------------------------------------------- +bool WKTFormatter::idOnTopLevelOnly() const { + return d->params_.idOnTopLevelOnly_; +} + +// --------------------------------------------------------------------------- + +bool WKTFormatter::topLevelHasId() const { + return d->stackHasId_.size() >= 2 && d->stackHasId_[1]; +} + +// --------------------------------------------------------------------------- + WKTFormatter::Version WKTFormatter::version() const { return d->params_.version_; } |
