aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crs.cpp9
-rw-r--r--test/unit/test_crs.cpp3
-rw-r--r--test/unit/test_io.cpp3
3 files changed, 15 insertions, 0 deletions
diff --git a/src/crs.cpp b/src/crs.cpp
index eec7a926..aa9209cd 100644
--- a/src/crs.cpp
+++ b/src/crs.cpp
@@ -861,7 +861,16 @@ void GeodeticCRS::_exportToWKT(io::WKTFormatter *formatter) const {
if (!isWKT2) {
unit._exportToWKT(formatter);
}
+
+ const auto oldAxisOutputRule = formatter->outputAxis();
+ if (oldAxisOutputRule ==
+ io::WKTFormatter::OutputAxisRule::WKT1_GDAL_EPSG_STYLE &&
+ isGeocentric()) {
+ formatter->setOutputAxis(io::WKTFormatter::OutputAxisRule::YES);
+ }
cs->_exportToWKT(formatter);
+ formatter->setOutputAxis(oldAxisOutputRule);
+
ObjectUsage::baseExportToWKT(formatter);
if (!isWKT2 && !formatter->useESRIDialect()) {
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp
index 55df5875..fa64620c 100644
--- a/test/unit/test_crs.cpp
+++ b/test/unit/test_crs.cpp
@@ -1107,6 +1107,9 @@ TEST(crs, geocentricCRS_as_WKT1_GDAL) {
" AUTHORITY[\"EPSG\",\"8901\"]],\n"
" UNIT[\"metre\",1,\n"
" AUTHORITY[\"EPSG\",\"9001\"]],\n"
+ " AXIS[\"Geocentric X\",OTHER],\n"
+ " AXIS[\"Geocentric Y\",OTHER],\n"
+ " AXIS[\"Geocentric Z\",NORTH],\n"
" AUTHORITY[\"EPSG\",\"4328\"]]");
}
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index fa0305cc..7fdb1358 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -493,6 +493,9 @@ TEST(wkt_parse, wkt1_geocentric_with_PROJ4_extension) {
" SPHEROID[\"WGS84\",6378137,298.257223563]],\n"
" PRIMEM[\"Greenwich\",0],\n"
" UNIT[\"Meter\",1],\n"
+ " AXIS[\"Geocentric X\",OTHER],\n"
+ " AXIS[\"Geocentric Y\",OTHER],\n"
+ " AXIS[\"Geocentric Z\",NORTH],\n"
" EXTENSION[\"PROJ4\",\"+proj=geocent +foo=bar +wktext\"]]";
auto obj = WKTParser().createFromWKT(wkt);