diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-10-08 14:50:55 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-10-08 14:50:55 +0200 |
| commit | 2118edd31bb060ce84181c2ca3d30591a3dcd68a (patch) | |
| tree | 7483ec93650c77f98f9821465578f5aca52bcb7a /test | |
| parent | 7be04dedc2b23d6836f994c9bc1412d6a23a7267 (diff) | |
| download | PROJ-2118edd31bb060ce84181c2ca3d30591a3dcd68a.tar.gz PROJ-2118edd31bb060ce84181c2ca3d30591a3dcd68a.zip | |
WKT concatenated operation parsing: fix when a axis order reversal conversion is the first or last operation (fixes #2890)
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/test_operation.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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<CoordinateOperation>(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 |
