aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-10-08 17:25:06 +0200
committerGitHub <noreply@github.com>2021-10-08 17:25:06 +0200
commit02225ff0bb11ea137751d9694978e61060f829bd (patch)
tree499e6c2471eb5d04f5c471f68a90db41b7009e96 /test/unit
parentc8b28d3fd2a8634d4dc97fb4850e56d8ab0a3e4b (diff)
parent2118edd31bb060ce84181c2ca3d30591a3dcd68a (diff)
downloadPROJ-02225ff0bb11ea137751d9694978e61060f829bd.tar.gz
PROJ-02225ff0bb11ea137751d9694978e61060f829bd.zip
Merge pull request #2891 from rouault/fix_2890
WKT concatenated operation parsing: fix when a axis order reversal conversion is the first or last operation (fixes #2890)
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_operation.cpp17
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