aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-10-12 11:12:53 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-10-12 11:12:53 +0200
commit785a6507068c7e8ae28d4286028ea0d12f607213 (patch)
treef79929b13555dd198a8dbb325691803621b231f2 /src/iso19111
parent4387332ea628282570d712d5b4b6dccc2ea5e604 (diff)
downloadPROJ-785a6507068c7e8ae28d4286028ea0d12f607213.tar.gz
PROJ-785a6507068c7e8ae28d4286028ea0d12f607213.zip
Geographic 3D CRS: allow to export to WKT1:ESRI if only the GEOGCS is known (and thus extrapolating a VERTCS) (fixes #2757)
Diffstat (limited to 'src/iso19111')
-rw-r--r--src/iso19111/crs.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index 0d157da1..575f6e2b 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -1850,11 +1850,39 @@ static bool exportAsESRIWktCompoundCRSWithEllipsoidalHeight(
auto vertCRSList = authFactory->createVerticalCRSFromDatum(
"ESRI", "from_geogdatum_" + *gdatum_ids[0]->codeSpace() + '_' +
gdatum_ids[0]->code());
- if (vertCRSList.size() != 1) {
- return false;
- }
self->demoteTo2D(std::string(), dbContext)->_exportToWKT(formatter);
- vertCRSList.front()->_exportToWKT(formatter);
+ if (vertCRSList.size() == 1) {
+ vertCRSList.front()->_exportToWKT(formatter);
+ } else {
+ // This will not be recognized properly by ESRI software
+ // See https://github.com/OSGeo/PROJ/issues/2757
+
+ const auto &axisList = geodCRS->coordinateSystem()->axisList();
+ assert(axisList.size() == 3U);
+
+ formatter->startNode(io::WKTConstants::VERTCS, false);
+ auto vertcs_name = l_esri_name;
+ if (starts_with(vertcs_name.c_str(), "GCS_"))
+ vertcs_name = vertcs_name.substr(4);
+ formatter->addQuotedString(vertcs_name);
+
+ gdatum->_exportToWKT(formatter);
+
+ // Seems to be a constant value...
+ formatter->startNode(io::WKTConstants::PARAMETER, false);
+ formatter->addQuotedString("Vertical_Shift");
+ formatter->add(0.0);
+ formatter->endNode();
+
+ formatter->startNode(io::WKTConstants::PARAMETER, false);
+ formatter->addQuotedString("Direction");
+ formatter->add(
+ axisList[2]->direction() == cs::AxisDirection::UP ? 1.0 : -1.0);
+ formatter->endNode();
+
+ axisList[2]->unit()._exportToWKT(formatter);
+ formatter->endNode();
+ }
return true;
}