aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-03-22 19:07:50 +0100
committerGitHub <noreply@github.com>2022-03-22 19:07:50 +0100
commit689189af924730a5663ceef9d9f74328e33670db (patch)
tree171f26e1a9b4418bd02e5ac195ea529865c278bd /test
parent8c51e3c99acc9083d82a5a7a6dae146e2a689f8e (diff)
parent169e1c5691858e0846eb7ede6b3778f8ec0a2892 (diff)
downloadPROJ-master.tar.gz
PROJ-master.zip
Merge pull request #3125 from rouault/import_proj4_datum_namesHEADmaster
Fix datum names when importing from PROJ4 crs strings (affects some transformations using geoidgrids)
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_io.cpp4
-rw-r--r--test/unit/test_operationfactory.cpp47
2 files changed, 50 insertions, 1 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index f883ddb7..dc511b80 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -9852,7 +9852,9 @@ TEST(io, projparse_merc_not_quite_google_mercator) {
EXPECT_TRUE(wkt.find("METHOD[\"Popular Visualisation Pseudo "
"Mercator\",ID[\"EPSG\",1024]") != std::string::npos)
<< wkt;
- EXPECT_TRUE(wkt.find("DATUM[\"unknown\",") != std::string::npos) << wkt;
+ EXPECT_TRUE(wkt.find("DATUM[\"unknown using nadgrids=@null\",") !=
+ std::string::npos)
+ << wkt;
EXPECT_EQ(
replaceAll(crs->exportToPROJString(PROJStringFormatter::create().get()),
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp
index 01d0da9b..0ff3e827 100644
--- a/test/unit/test_operationfactory.cpp
+++ b/test/unit/test_operationfactory.cpp
@@ -4230,6 +4230,53 @@ TEST(
TEST(
operation,
+ compoundCRS_to_compoundCRS_with_bound_crs_in_horiz_and_vert_same_ellsp_but_different_towgs84_different_geoidgrids) {
+ auto objSrc = PROJStringParser().createFromPROJString(
+ "+proj=longlat +ellps=GRS80 +towgs84=1,2,3 +geoidgrids=@foo.gtx "
+ "+type=crs");
+ auto src = nn_dynamic_pointer_cast<CRS>(objSrc);
+ ASSERT_TRUE(src != nullptr);
+ auto objDst = PROJStringParser().createFromPROJString(
+ "+proj=longlat +ellps=GRS80 +towgs84=4,5,6 +geoidgrids=@bar.gtx "
+ "+type=crs");
+ auto dst = nn_dynamic_pointer_cast<CRS>(objDst);
+ ASSERT_TRUE(dst != nullptr);
+
+ auto srcGeog = src->extractGeographicCRS();
+ ASSERT_TRUE(srcGeog != nullptr);
+ ASSERT_TRUE(srcGeog->datum() != nullptr);
+ auto dstGeog = dst->extractGeographicCRS();
+ ASSERT_TRUE(dstGeog != nullptr);
+ ASSERT_TRUE(dstGeog->datum() != nullptr);
+ EXPECT_FALSE(srcGeog->datum()->isEquivalentTo(
+ dstGeog->datum().get(), IComparable::Criterion::EQUIVALENT));
+
+ auto op = CoordinateOperationFactory::create()->createOperation(
+ NN_CHECK_ASSERT(src), NN_CHECK_ASSERT(dst));
+ ASSERT_TRUE(op != nullptr);
+ // Check there's no proj=push +v_1 +v_2
+ EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +proj=unitconvert +xy_in=deg +xy_out=rad "
+ "+step +proj=push +v_3 "
+ "+step +proj=cart +ellps=GRS80 "
+ "+step +proj=helmert +x=1 +y=2 +z=3 "
+ "+step +inv +proj=cart +ellps=WGS84 "
+ "+step +proj=pop +v_3 "
+ "+step +proj=vgridshift +grids=@foo.gtx +multiplier=1 "
+ "+step +inv +proj=vgridshift +grids=@bar.gtx +multiplier=1 "
+ "+step +proj=push +v_3 "
+ "+step +proj=cart +ellps=WGS84 "
+ "+step +proj=helmert +x=-4 +y=-5 +z=-6 "
+ "+step +inv +proj=cart +ellps=GRS80 "
+ "+step +proj=pop +v_3 "
+ "+step +proj=unitconvert +xy_in=rad +xy_out=deg");
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(
+ operation,
compoundCRS_to_compoundCRS_with_bound_crs_in_horiz_and_vert_WKT1_same_geoidgrids_context) {
auto objSrc = WKTParser().createFromWKT(
"COMPD_CS[\"NAD83 / Alabama West + NAVD88 height - Geoid12B "