aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-09-18 13:31:36 +0200
committerGitHub <noreply@github.com>2020-09-18 13:31:36 +0200
commit81aaa47b4e1f7799ad59f07d738823184f20a9cf (patch)
tree448fb1ab3c3152224450b6a07f723ba14623b727 /test/unit/test_operation.cpp
parent1e11bf646d2cf9b731b02f2260c68fe2a5a21cf4 (diff)
parent75074ce863e36299ec39b39decdd435eed15ad63 (diff)
downloadPROJ-81aaa47b4e1f7799ad59f07d738823184f20a9cf.tar.gz
PROJ-81aaa47b4e1f7799ad59f07d738823184f20a9cf.zip
Merge pull request #2357 from rouault/fix_2356
Adjust createBoundCRSToWGS84IfPossible() and operation filtering (for POSGAR 2007 to WGS84 issues) (fixes #2356)
Diffstat (limited to 'test/unit/test_operation.cpp')
-rw-r--r--test/unit/test_operation.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index 0238638d..23f3489b 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -4599,7 +4599,7 @@ TEST(operation, geogCRS_to_geogCRS_context_NAD27_to_WGS84) {
authFactory->createCoordinateReferenceSystem("4267"), // NAD27
authFactory->createCoordinateReferenceSystem("4326"), // WGS84
ctxt);
- ASSERT_EQ(list.size(), 78U);
+ ASSERT_EQ(list.size(), 79U);
EXPECT_EQ(list[0]->nameStr(),
"NAD27 to WGS 84 (33)"); // 1.0 m, Canada - NAD27
EXPECT_EQ(list[1]->nameStr(),
@@ -5050,7 +5050,7 @@ TEST(operation, geogCRS_to_geogCRS_context_concatenated_operation) {
authFactory->createCoordinateReferenceSystem("4807"), // NTF(Paris)
authFactory->createCoordinateReferenceSystem("4171"), // RGF93
ctxt);
- ASSERT_EQ(list.size(), 5U);
+ ASSERT_EQ(list.size(), 4U);
EXPECT_EQ(list[0]->nameStr(), "NTF (Paris) to RGF93 (1)");
EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
@@ -5158,7 +5158,7 @@ TEST(operation, geogCRS_to_geogCRS_CH1903_to_CH1903plus_context) {
authFactory->createCoordinateReferenceSystem("4149"), // CH1903
authFactory->createCoordinateReferenceSystem("4150"), // CH1903+
ctxt);
- ASSERT_TRUE(list.size() == 2U || list.size() == 3U);
+ ASSERT_TRUE(list.size() == 1U);
EXPECT_EQ(list[0]->nameStr(), "CH1903 to CH1903+ (1)");
EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
@@ -5167,25 +5167,6 @@ TEST(operation, geogCRS_to_geogCRS_CH1903_to_CH1903plus_context) {
"+step +proj=hgridshift +grids=ch_swisstopo_CHENyx06a.tif "
"+step +proj=unitconvert +xy_in=rad +xy_out=deg "
"+step +proj=axisswap +order=2,1");
-
- if (list.size() == 2U) {
- // Grids not there
- EXPECT_EQ(list[1]->nameStr(),
- "CH1903 to ETRS89 (1) + Inverse of CH1903+ to ETRS89 (1)");
- EXPECT_EQ(
- list[1]->exportToPROJString(PROJStringFormatter::create().get()),
- "+proj=noop");
- } else {
- // Grids available
- EXPECT_EQ(list[1]->nameStr(),
- "CH1903 to ETRS89 (2) + Inverse of CH1903+ to ETRS89 (1)");
-
- EXPECT_EQ(list[2]->nameStr(),
- "CH1903 to ETRS89 (1) + Inverse of CH1903+ to ETRS89 (1)");
- EXPECT_EQ(
- list[2]->exportToPROJString(PROJStringFormatter::create().get()),
- "+proj=noop");
- }
}
// ---------------------------------------------------------------------------
@@ -6069,7 +6050,7 @@ TEST(operation, projCRS_to_projCRS_context_compatible_area) {
authFactory->createCoordinateReferenceSystem(
"2171"), // Pulkovo 42 Poland I
ctxt);
- ASSERT_EQ(list.size(), 1U);
+ ASSERT_EQ(list.size(), 2U);
EXPECT_EQ(list[0]->nameStr(),
"Inverse of UTM zone 34N + Inverse of Pulkovo 1942(58) to WGS 84 "
"(1) + Poland zone I");
@@ -6088,7 +6069,7 @@ TEST(operation, projCRS_to_projCRS_context_compatible_area_bis) {
"3844"), // Pulkovo 42 Stereo 70 (Romania)
authFactory->createCoordinateReferenceSystem("32634"), // UTM 34
ctxt);
- ASSERT_EQ(list.size(), 1U);
+ ASSERT_EQ(list.size(), 3U);
EXPECT_EQ(list[0]->nameStr(), "Inverse of Stereo 70 + "
"Pulkovo 1942(58) to WGS 84 "
"(19) + UTM zone 34N");
@@ -6107,7 +6088,7 @@ TEST(operation, projCRS_to_projCRS_context_one_incompatible_area) {
authFactory->createCoordinateReferenceSystem(
"2171"), // Pulkovo 42 Poland I
ctxt);
- ASSERT_EQ(list.size(), 1U);
+ ASSERT_EQ(list.size(), 2U);
EXPECT_EQ(list[0]->nameStr(),
"Inverse of UTM zone 31N + Inverse of Pulkovo 1942(58) to WGS 84 "
"(1) + Poland zone I");
@@ -6233,6 +6214,24 @@ TEST(operation, projCRS_to_projCRS_through_geog3D) {
// ---------------------------------------------------------------------------
+TEST(operation, transform_from_amersfoort_rd_new_to_epsg_4326) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ authFactory->createCoordinateReferenceSystem("28992"),
+ authFactory->createCoordinateReferenceSystem("4326"), ctxt);
+ ASSERT_EQ(list.size(), 2U);
+ // The order matters: "Amersfoort to WGS 84 (4)" replaces "Amersfoort to WGS
+ // 84 (3)"
+ EXPECT_EQ(list[0]->nameStr(),
+ "Inverse of RD New + Amersfoort to WGS 84 (4)");
+ EXPECT_EQ(list[1]->nameStr(),
+ "Inverse of RD New + Amersfoort to WGS 84 (3)");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, boundCRS_of_geogCRS_to_geogCRS) {
auto boundCRS = BoundCRS::createFromTOWGS84(
GeographicCRS::EPSG_4807, std::vector<double>{1, 2, 3, 4, 5, 6, 7});