aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operationfactory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-12-14 21:12:43 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-12-14 21:12:43 +0100
commit95340fb1d1011d6864d82b60194eb77df9e9e38f (patch)
tree30e2d3909d33c04f7966f996f90c971cd7023ade /test/unit/test_operationfactory.cpp
parentbfc54bbac8550e18d352468032ad0b3d5ca2d328 (diff)
downloadPROJ-95340fb1d1011d6864d82b60194eb77df9e9e38f.tar.gz
PROJ-95340fb1d1011d6864d82b60194eb77df9e9e38f.zip
createOperations(): fix inconsistent chaining exception when transforming from BoundCRS of projected CRS based on NTF Paris to BoundCRS of geog CRS NTF Paris. Fixes https://github.com/OSGeo/gdal/issues/3273
Diffstat (limited to 'test/unit/test_operationfactory.cpp')
-rw-r--r--test/unit/test_operationfactory.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp
index b3f6f5cb..b71c3d66 100644
--- a/test/unit/test_operationfactory.cpp
+++ b/test/unit/test_operationfactory.cpp
@@ -2501,6 +2501,45 @@ TEST(operation, boundCRS_of_projCRS_towgs84_to_boundCRS_of_projCRS_nadgrids) {
// ---------------------------------------------------------------------------
+static CRSNNPtr buildCRSFromProjStrThroughWKT(const std::string &projStr) {
+ auto crsFromProj = nn_dynamic_pointer_cast<CRS>(
+ PROJStringParser().createFromPROJString(projStr));
+ if (crsFromProj == nullptr) {
+ throw "crsFromProj == nullptr";
+ }
+ auto crsFromWkt = nn_dynamic_pointer_cast<CRS>(
+ WKTParser().createFromWKT(crsFromProj->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT2_2019).get())));
+ if (crsFromWkt == nullptr) {
+ throw "crsFromWkt == nullptr";
+ }
+ return NN_NO_CHECK(crsFromWkt);
+}
+
+TEST(operation,
+ boundCRS_to_boundCRS_with_base_geog_crs_different_from_source_of_transf) {
+
+ auto src = buildCRSFromProjStrThroughWKT(
+ "+proj=lcc +lat_1=49 +lat_0=49 +lon_0=0 +k_0=0.999877499 +x_0=600000 "
+ "+y_0=200000 +ellps=clrk80ign +pm=paris +towgs84=-168,-60,320,0,0,0,0 "
+ "+units=m +no_defs +type=crs");
+ auto dst = buildCRSFromProjStrThroughWKT(
+ "+proj=longlat +ellps=clrk80ign +pm=paris "
+ "+towgs84=-168,-60,320,0,0,0,0 +no_defs +type=crs");
+
+ auto op = CoordinateOperationFactory::create()->createOperation(src, dst);
+ ASSERT_TRUE(op != nullptr);
+ EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +inv +proj=lcc +lat_1=49 +lat_0=49 +lon_0=0 "
+ "+k_0=0.999877499 +x_0=600000 +y_0=200000 +ellps=clrk80ign "
+ "+pm=paris "
+ "+step +proj=longlat +ellps=clrk80ign +pm=paris "
+ "+step +proj=unitconvert +xy_in=rad +xy_out=deg");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, boundCRS_with_basecrs_with_extent_to_geogCRS) {
auto wkt =