aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/io.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-01-08 16:22:15 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-01-08 21:25:07 +0100
commitf5e5435fd5071d550e0d13f7a5d71e09c1fab2c0 (patch)
treef569d5270f7cb34adf056d04c84a23db6b4f6ed0 /src/iso19111/io.cpp
parentfdee4277efb45b07db2dcc4d93376cbd01cfbd0a (diff)
downloadPROJ-f5e5435fd5071d550e0d13f7a5d71e09c1fab2c0.tar.gz
PROJ-f5e5435fd5071d550e0d13f7a5d71e09c1fab2c0.zip
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...
Diffstat (limited to 'src/iso19111/io.cpp')
-rw-r--r--src/iso19111/io.cpp21
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();