aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-10-18 21:54:55 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-10-18 21:55:22 +0200
commit0af6db3af53160fcc94c9bb9c9198bed12e484cc (patch)
tree66825b6fde00022f9ddca81ed4f006af96aa833b /test/unit/test_operation.cpp
parent5fbcf98c9ac6184a066d66a39d55bd3084926b2f (diff)
downloadPROJ-0af6db3af53160fcc94c9bb9c9198bed12e484cc.tar.gz
PROJ-0af6db3af53160fcc94c9bb9c9198bed12e484cc.zip
createOperations(): fix double vertical unit conversion from CompoundCRS to other CRS when the horizontal part of the projected CRS uses non-metre unit
Fix issue reported on https://lists.osgeo.org/pipermail/proj/2019-October/008939.html
Diffstat (limited to 'test/unit/test_operation.cpp')
-rw-r--r--test/unit/test_operation.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index fcbbb566..53dcb861 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -7252,6 +7252,30 @@ TEST(operation, compoundCRS_from_WKT2_no_id_to_geogCRS_3D_context) {
// ---------------------------------------------------------------------------
+TEST(operation, compoundCRS_with_non_meter_horiz_and_vertical_to_geog) {
+ auto objSrc = PROJStringParser().createFromPROJString(
+ "+proj=utm +zone=31 +datum=WGS84 +units=us-ft +vunits=us-ft +type=crs");
+ auto src = nn_dynamic_pointer_cast<CRS>(objSrc);
+ ASSERT_TRUE(src != nullptr);
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ NN_NO_CHECK(src), authFactory->createCoordinateReferenceSystem("4326"),
+ ctxt);
+ ASSERT_EQ(list.size(), 1U);
+ // Check that vertical unit conversion is done just once
+ EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +proj=unitconvert +xy_in=us-ft +xy_out=m "
+ "+step +inv +proj=utm +zone=31 +ellps=WGS84 "
+ "+step +proj=unitconvert +xy_in=rad +z_in=us-ft "
+ "+xy_out=deg +z_out=m "
+ "+step +proj=axisswap +order=2,1");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, boundCRS_to_compoundCRS) {
auto objSrc = PROJStringParser().createFromPROJString(
"+proj=longlat +ellps=GRS67 +nadgrids=@foo.gsb +type=crs");