diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-09-28 14:47:11 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-09-28 14:47:11 +0200 |
| commit | f13c584c057dd9866284deb2cb646e507df0b4bb (patch) | |
| tree | 9b77ebb4165be3dc715a5aa5ef0ded0a80efa2ed /test | |
| parent | 40ab72f2e9d913c7128fde24576183068dcd7ee2 (diff) | |
| download | PROJ-f13c584c057dd9866284deb2cb646e507df0b4bb.tar.gz PROJ-f13c584c057dd9866284deb2cb646e507df0b4bb.zip | |
test: add tests of operations between geographic/geodetic and projected IAU CRS
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/test_operationfactory.cpp | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp index 31b23287..2246c60c 100644 --- a/test/unit/test_operationfactory.cpp +++ b/test/unit/test_operationfactory.cpp @@ -7010,3 +7010,135 @@ TEST(operation, "+proj=axisswap +order=1,-2"); } } + +// --------------------------------------------------------------------------- + +TEST( + operation, + createOperation_ellipsoidal_ographic_west_to_projected_of_ellipsoidal_ographic_west) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "IAU_2015"); + auto op = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19901"), + authFactory->createCoordinateReferenceSystem("19911")); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +proj=axisswap +order=-2,1 " + "+step +proj=unitconvert +xy_in=deg +xy_out=rad " + "+step +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260 " + "+step +proj=axisswap +order=-1,2"); + + // Inverse + auto op2 = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19911"), + authFactory->createCoordinateReferenceSystem("19901")); + ASSERT_TRUE(op2 != nullptr); + EXPECT_EQ(op2->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=axisswap +order=-1,2 " + "+step +inv +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg " + "+step +proj=axisswap +order=2,-1"); +} + +// --------------------------------------------------------------------------- + +TEST( + operation, + createOperation_ellipsoidal_ographic_west_to_projected_of_ellipsoidal_ocentric) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "IAU_2015"); + auto op = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19901"), + authFactory->createCoordinateReferenceSystem("19912")); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +proj=axisswap +order=-2,1 " + "+step +proj=unitconvert +xy_in=deg +xy_out=rad " + "+step +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260"); + + // Inverse + auto op2 = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19912"), + authFactory->createCoordinateReferenceSystem("19901")); + ASSERT_TRUE(op2 != nullptr); + EXPECT_EQ(op2->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg " + "+step +proj=axisswap +order=2,-1"); +} + +// --------------------------------------------------------------------------- + +TEST( + operation, + createOperation_ellipsoidal_ocentric_to_projected_of_ellipsoidal_ocentric) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "IAU_2015"); + auto op = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19902"), + authFactory->createCoordinateReferenceSystem("19912")); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +proj=axisswap +order=2,1 " + "+step +proj=unitconvert +xy_in=deg +xy_out=rad " + "+step +inv +proj=geoc +a=2440530 +b=2438260 " + "+step +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260"); + + // Inverse + auto op2 = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19912"), + authFactory->createCoordinateReferenceSystem("19902")); + ASSERT_TRUE(op2 != nullptr); + EXPECT_EQ(op2->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260 " + "+step +proj=geoc +a=2440530 +b=2438260 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg " + "+step +proj=axisswap +order=2,1"); +} + +// --------------------------------------------------------------------------- + +TEST( + operation, + createOperation_ellipsoidal_ocentric_to_projected_of_ellipsoidal_ographic_west) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "IAU_2015"); + auto op = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19902"), + authFactory->createCoordinateReferenceSystem("19911")); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +proj=axisswap +order=2,1 " + "+step +proj=unitconvert +xy_in=deg +xy_out=rad " + "+step +inv +proj=geoc +a=2440530 +b=2438260 " + "+step +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260 " + "+step +proj=axisswap +order=-1,2"); + + // Inverse + auto op2 = CoordinateOperationFactory::create()->createOperation( + authFactory->createCoordinateReferenceSystem("19911"), + authFactory->createCoordinateReferenceSystem("19902")); + ASSERT_TRUE(op2 != nullptr); + EXPECT_EQ(op2->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=axisswap +order=-1,2 " + "+step +inv +proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 " + "+a=2440530 +b=2438260 " + "+step +proj=geoc +a=2440530 +b=2438260 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg " + "+step +proj=axisswap +order=2,1"); +} |
