diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-11-04 15:24:44 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-11-04 18:50:36 +0100 |
| commit | 848ee7b6a8bf56a9d967f104ba2ef2ad92dc48d5 (patch) | |
| tree | 6dcf64f6e3e351249928227ef11e74c1b21d3133 /test/unit/test_crs.cpp | |
| parent | 9c28184f6f32aeaa2951c994453c4f99572a11dc (diff) | |
| download | PROJ-848ee7b6a8bf56a9d967f104ba2ef2ad92dc48d5.tar.gz PROJ-848ee7b6a8bf56a9d967f104ba2ef2ad92dc48d5.zip | |
createBoundCRSToWGS84IfPossible(): make it return same result with a CRS built from EPSG code or WKT1
Related to https://github.com/OSGeo/gdal/issues/3144
Diffstat (limited to 'test/unit/test_crs.cpp')
| -rw-r--r-- | test/unit/test_crs.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index a0fee905..38afdce3 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -5796,6 +5796,31 @@ TEST(crs, crs_createBoundCRSToWGS84IfPossible) { CoordinateOperationContext::IntermediateCRSUse::NEVER), crs_5340); } + + // Check that we get the same result from an EPSG code and a CRS created + // from its WKT1 representation. + { + // Pulkovo 1942 / CS63 zone A2 + auto crs = factory->createCoordinateReferenceSystem("2936"); + + // Two candidate transformations found, so not picking up any + EXPECT_EQ(crs->createBoundCRSToWGS84IfPossible( + dbContext, + CoordinateOperationContext::IntermediateCRSUse::NEVER), + crs); + + auto wkt = crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL, dbContext) + .get()); + auto obj = + WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt); + auto crs_from_wkt = nn_dynamic_pointer_cast<CRS>(obj); + ASSERT_TRUE(crs_from_wkt != nullptr); + EXPECT_EQ(crs_from_wkt->createBoundCRSToWGS84IfPossible( + dbContext, + CoordinateOperationContext::IntermediateCRSUse::NEVER), + crs_from_wkt); + } } // --------------------------------------------------------------------------- |
