From 2118edd31bb060ce84181c2ca3d30591a3dcd68a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 8 Oct 2021 14:50:55 +0200 Subject: WKT concatenated operation parsing: fix when a axis order reversal conversion is the first or last operation (fixes #2890) --- test/unit/test_operation.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index f76647e2..0e27aa9b 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -5429,6 +5429,20 @@ TEST(operation, normalizeForVisualization) { auto authFactory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + const auto checkThroughWKTRoundtrip = [](const CoordinateOperationNNPtr + &opRef) { + auto wkt = opRef->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT2_2019).get()); + auto objFromWkt = WKTParser().createFromWKT(wkt); + auto opFromWkt = + nn_dynamic_pointer_cast(objFromWkt); + ASSERT_TRUE(opFromWkt != nullptr); + EXPECT_TRUE(opRef->_isEquivalentTo(opFromWkt.get())); + EXPECT_EQ( + opFromWkt->exportToPROJString(PROJStringFormatter::create().get()), + opRef->exportToPROJString(PROJStringFormatter::create().get())); + }; + // Source(geographic) must be inverted { auto src = authFactory->createCoordinateReferenceSystem("4326"); @@ -5443,6 +5457,7 @@ TEST(operation, normalizeForVisualization) { "+proj=pipeline " "+step +proj=unitconvert +xy_in=deg +xy_out=rad " "+step +proj=utm +zone=31 +ellps=WGS84"); + checkThroughWKTRoundtrip(opNormalized); } // Target(geographic) must be inverted @@ -5459,6 +5474,7 @@ TEST(operation, normalizeForVisualization) { "+proj=pipeline " "+step +inv +proj=utm +zone=31 +ellps=WGS84 " "+step +proj=unitconvert +xy_in=rad +xy_out=deg"); + checkThroughWKTRoundtrip(opNormalized); } // Source(geographic) and target(projected) must be inverted @@ -5475,6 +5491,7 @@ TEST(operation, normalizeForVisualization) { "+proj=pipeline " "+step +proj=unitconvert +xy_in=deg +xy_out=rad " "+step +proj=utm +zone=28 +ellps=GRS80"); + checkThroughWKTRoundtrip(opNormalized); } // No inversion -- cgit v1.2.3