diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-08-26 18:12:38 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-08-26 18:12:38 +0200 |
| commit | 78302efb70eb4b49610cda6a60bf9ce39b82264f (patch) | |
| tree | 1af45e6a740795b096d8ffd1a2cd5bf989884fe1 /test/unit/test_operation.cpp | |
| parent | 4d972f5d93857437c1b1b4912cc803df27f45a26 (diff) | |
| download | PROJ-78302efb70eb4b49610cda6a60bf9ce39b82264f.tar.gz PROJ-78302efb70eb4b49610cda6a60bf9ce39b82264f.zip | |
createOperations(): fix pipeline generation when a CRS has terms like +datum=NAD27 and +over, where the datum was just replaced by its ellipsoid
Diffstat (limited to 'test/unit/test_operation.cpp')
| -rw-r--r-- | test/unit/test_operation.cpp | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 1a9b69d5..f95f94bd 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -7059,7 +7059,81 @@ TEST(operation, createOperation_fallback_to_proj4_strings) { 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=longlat +geoc +ellps=WGS84 " + "+step +proj=longlat +geoc +datum=WGS84 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg"); +} + +// --------------------------------------------------------------------------- + +TEST( + operation, + createOperation_fallback_to_proj4_strings_regular_with_datum_to_projliteral) { + auto objSrc = PROJStringParser().createFromPROJString( + "+proj=utm +zone=11 +datum=NAD27 +type=crs"); + auto src = nn_dynamic_pointer_cast<CRS>(objSrc); + ASSERT_TRUE(src != nullptr); + + auto objDst = PROJStringParser().createFromPROJString( + "+proj=longlat +datum=WGS84 +over +type=crs"); + auto dst = nn_dynamic_pointer_cast<CRS>(objDst); + ASSERT_TRUE(dst != nullptr); + + auto op = CoordinateOperationFactory::create()->createOperation( + NN_CHECK_ASSERT(src), NN_CHECK_ASSERT(dst)); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=utm +zone=11 +datum=NAD27 " + "+step +proj=longlat +datum=WGS84 +over " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg"); +} + +// --------------------------------------------------------------------------- + +TEST( + operation, + createOperation_fallback_to_proj4_strings_regular_with_nadgrids_to_projliteral) { + auto objSrc = PROJStringParser().createFromPROJString( + "+proj=utm +zone=11 +ellps=clrk66 +nadgrids=@conus +type=crs"); + auto src = nn_dynamic_pointer_cast<CRS>(objSrc); + ASSERT_TRUE(src != nullptr); + + auto objDst = PROJStringParser().createFromPROJString( + "+proj=longlat +datum=WGS84 +over +type=crs"); + auto dst = nn_dynamic_pointer_cast<CRS>(objDst); + ASSERT_TRUE(dst != nullptr); + + auto op = CoordinateOperationFactory::create()->createOperation( + NN_CHECK_ASSERT(src), NN_CHECK_ASSERT(dst)); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=utm +zone=11 +ellps=clrk66 +nadgrids=@conus " + "+step +proj=longlat +datum=WGS84 +over " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg"); +} + +// --------------------------------------------------------------------------- + +TEST(operation, + createOperation_fallback_to_proj4_strings_projliteral_to_projliteral) { + auto objSrc = PROJStringParser().createFromPROJString( + "+proj=utm +zone=11 +datum=NAD27 +over +type=crs"); + auto src = nn_dynamic_pointer_cast<CRS>(objSrc); + ASSERT_TRUE(src != nullptr); + + auto objDst = PROJStringParser().createFromPROJString( + "+proj=longlat +datum=WGS84 +over +type=crs"); + auto dst = nn_dynamic_pointer_cast<CRS>(objDst); + ASSERT_TRUE(dst != nullptr); + + auto op = CoordinateOperationFactory::create()->createOperation( + NN_CHECK_ASSERT(src), NN_CHECK_ASSERT(dst)); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +inv +proj=utm +zone=11 +datum=NAD27 +over " + "+step +proj=longlat +datum=WGS84 +over " "+step +proj=unitconvert +xy_in=rad +xy_out=deg"); } |
