aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-10-22 21:22:43 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-10-22 21:22:43 +0200
commit82cd218a7ab44eafef92445f2caaec0fb6ec799a (patch)
tree860e6f753d9da64ab8ab2f5bcce7d7b961f1a0e8
parentf2cd2b3b99746dd9d08b6d388fa91055643f0747 (diff)
downloadPROJ-82cd218a7ab44eafef92445f2caaec0fb6ec799a.tar.gz
PROJ-82cd218a7ab44eafef92445f2caaec0fb6ec799a.zip
WKT1_ESRI export: export CompoundCRS as PROJCS[...],VERTCS[...] or GEOGCS[...],VERTCS[...]
-rw-r--r--src/iso19111/crs.cpp22
-rw-r--r--test/unit/test_io.cpp6
2 files changed, 20 insertions, 8 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index 52b10119..1a17ac67 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -4528,15 +4528,21 @@ CRSNNPtr CompoundCRS::createLax(const util::PropertyMap &properties,
//! @cond Doxygen_Suppress
void CompoundCRS::_exportToWKT(io::WKTFormatter *formatter) const {
const bool isWKT2 = formatter->version() == io::WKTFormatter::Version::WKT2;
- formatter->startNode(isWKT2 ? io::WKTConstants::COMPOUNDCRS
- : io::WKTConstants::COMPD_CS,
- !identifiers().empty());
- formatter->addQuotedString(nameStr());
- for (const auto &crs : componentReferenceSystems()) {
- crs->_exportToWKT(formatter);
+ const auto &l_components = componentReferenceSystems();
+ if (!isWKT2 && formatter->useESRIDialect() && l_components.size() == 2) {
+ l_components[0]->_exportToWKT(formatter);
+ l_components[1]->_exportToWKT(formatter);
+ } else {
+ formatter->startNode(isWKT2 ? io::WKTConstants::COMPOUNDCRS
+ : io::WKTConstants::COMPD_CS,
+ !identifiers().empty());
+ formatter->addQuotedString(nameStr());
+ for (const auto &crs : l_components) {
+ crs->_exportToWKT(formatter);
+ }
+ ObjectUsage::baseExportToWKT(formatter);
+ formatter->endNode();
}
- ObjectUsage::baseExportToWKT(formatter);
- formatter->endNode();
}
//! @endcond
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 59bd5bab..5cef886f 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -2723,6 +2723,12 @@ TEST(wkt_parse, implicit_compound_CRS_ESRI) {
ASSERT_TRUE(crs != nullptr);
EXPECT_EQ(crs->nameStr(), "NAD83(2011) / Colorado Central (ftUS) + "
"CGVD2013(CGG2013) height");
+
+ EXPECT_EQ(
+ crs->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
+ .get()),
+ wkt);
}
// ---------------------------------------------------------------------------