From f5e5435fd5071d550e0d13f7a5d71e09c1fab2c0 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 8 Jan 2019 16:22:15 +0100 Subject: ISO19111: remove PROJ.5 specific format for CRS (refs #1214) As discussed in https://github.com/OSGeo/proj.4/issues/1214#issuecomment-452084720, the introduction of a new PROJ.5 format to export CRS using pipeline/unitconvert/axisswap as an attempt of improving the PROJ.4 format used by GDAL and other products is likely a dead-end since it is still lossy in many aspects and can cause confusion with coodinate operations. Consequently the PROJ_5 convention will be identical to PROJ_4 for CRS export. Note: on the import side, I've kept the code that could parse unitconvert and axisswap when building a CRS definition from a pipeline. It is there as a hidden feature as it was kind of a tear to remove that code in case it might still be useful... --- src/iso19111/io.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/iso19111/io.cpp') 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(this) != nullptr; + if (bIsCRS) { + formatter->setCRSExport(true); + } _exportToPROJString(formatter); - if (formatter->getAddNoDefs() && - formatter->convention() == - io::PROJStringFormatter::Convention::PROJ_4 && - dynamic_cast(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(); -- cgit v1.2.3