diff options
Diffstat (limited to 'src/iso19111/io.cpp')
| -rw-r--r-- | src/iso19111/io.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index cfccd70f..13a8f236 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -4596,15 +4596,19 @@ IPROJStringExportable::~IPROJStringExportable() = default; std::string IPROJStringExportable::exportToPROJString( PROJStringFormatter *formatter) const { + const bool bIsCRS = dynamic_cast<const crs::CRS *>(this) != nullptr; + if (bIsCRS) { + formatter->setCRSExport(true); + } _exportToPROJString(formatter); - if (formatter->getAddNoDefs() && - formatter->convention() == - io::PROJStringFormatter::Convention::PROJ_4 && - dynamic_cast<const crs::CRS *>(this)) { + if (formatter->getAddNoDefs() && bIsCRS) { if (!formatter->hasParam("no_defs")) { formatter->addParam("no_defs"); } } + if (bIsCRS) { + formatter->setCRSExport(false); + } return formatter->toString(); } //! @endcond @@ -4673,6 +4677,7 @@ struct PROJStringFormatter::Private { bool useETMercForTMercSet_ = false; bool addNoDefs_ = true; bool coordOperationOptimizations_ = false; + bool crsExport_ = false; std::string result_{}; @@ -5311,6 +5316,14 @@ void PROJStringFormatter::ingestPROJString( // --------------------------------------------------------------------------- +void PROJStringFormatter::setCRSExport(bool b) { d->crsExport_ = b; } + +// --------------------------------------------------------------------------- + +bool PROJStringFormatter::getCRSExport() const { return d->crsExport_; } + +// --------------------------------------------------------------------------- + void PROJStringFormatter::startInversion() { PROJStringFormatter::Private::InversionStackElt elt; elt.startIter = d->steps_.end(); |
