diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-06-16 20:07:40 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-06-16 20:07:40 +0200 |
| commit | 3d9aa5c82f667e93bee4d9d4b17a11df8842559b (patch) | |
| tree | c5d3f80adefb74cfcdc33df00af92ba0085b40b7 /test/unit | |
| parent | 3005bcbc159d2a402eeecb6f568da4e85a7e0411 (diff) | |
| download | PROJ-3d9aa5c82f667e93bee4d9d4b17a11df8842559b.tar.gz PROJ-3d9aa5c82f667e93bee4d9d4b17a11df8842559b.zip | |
createOperations(): fix transformations between BoundCRS and Geocentric CRS
Diffstat (limited to 'test/unit')
| -rw-r--r-- | test/unit/test_c_api.cpp | 3 | ||||
| -rw-r--r-- | test/unit/test_operation.cpp | 45 |
2 files changed, 46 insertions, 2 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 2847d88d..a1918fb7 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -2617,8 +2617,7 @@ TEST_F(CApi, proj_context_get_database_metadata) { EXPECT_TRUE(proj_context_get_database_metadata(m_ctxt, "IGNF.VERSION") != nullptr); - EXPECT_TRUE(proj_context_get_database_metadata(m_ctxt, "FOO") == - nullptr); + EXPECT_TRUE(proj_context_get_database_metadata(m_ctxt, "FOO") == nullptr); } // --------------------------------------------------------------------------- diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 6ef6e686..9ebb3794 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -6251,6 +6251,51 @@ TEST(operation, boundCRS_of_geogCRS_to_geogCRS) { // --------------------------------------------------------------------------- +TEST(operation, boundCRS_of_geogCRS_to_geodCRS) { + auto boundCRS = BoundCRS::createFromTOWGS84( + GeographicCRS::EPSG_4807, std::vector<double>{1, 2, 3, 4, 5, 6, 7}); + auto op = CoordinateOperationFactory::create()->createOperation( + boundCRS, GeodeticCRS::EPSG_4978); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline +step " + "+proj=axisswap +order=2,1 " + "+step +proj=unitconvert +xy_in=grad +xy_out=rad " + "+step +inv +proj=longlat +ellps=clrk80ign +pm=paris " + "+step +proj=cart +ellps=clrk80ign " + "+step +proj=helmert +x=1 +y=2 +z=3 +rx=4 +ry=5 +rz=6 +s=7 " + "+convention=position_vector"); +} + +// --------------------------------------------------------------------------- + +TEST(operation, boundCRS_of_geogCRS_to_geodCRS_not_related_to_hub) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + auto boundCRS = BoundCRS::createFromTOWGS84( + GeographicCRS::EPSG_4807, std::vector<double>{1, 2, 3, 4, 5, 6, 7}); + auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0); + auto list = CoordinateOperationFactory::create()->createOperations( + boundCRS, + // ETRS89 geocentric + authFactory->createCoordinateReferenceSystem("4936"), ctxt); + ASSERT_EQ(list.size(), 1U); + EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline +step " + "+proj=axisswap +order=2,1 " + "+step +proj=unitconvert +xy_in=grad +xy_out=rad " + "+step +inv +proj=longlat +ellps=clrk80ign +pm=paris " + "+step +proj=push +v_3 " + "+step +proj=cart +ellps=clrk80ign " + "+step +proj=helmert +x=1 +y=2 +z=3 +rx=4 +ry=5 +rz=6 +s=7 " + "+convention=position_vector " + "+step +inv +proj=cart +ellps=GRS80 " + "+step +proj=pop +v_3 " + "+step +proj=cart +ellps=GRS80"); +} + +// --------------------------------------------------------------------------- + TEST(operation, boundCRS_of_geogCRS_to_geogCRS_with_area) { auto boundCRS = BoundCRS::createFromTOWGS84( GeographicCRS::EPSG_4267, std::vector<double>{1, 2, 3, 4, 5, 6, 7}); |
