aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_crs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_crs.cpp')
-rw-r--r--test/unit/test_crs.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp
index ec30580a..c2031081 100644
--- a/test/unit/test_crs.cpp
+++ b/test/unit/test_crs.cpp
@@ -4058,6 +4058,42 @@ TEST(crs, compoundCRS_identify_db) {
// Just check we don't get an exception
crs->identify(factory);
}
+ // Identify from ESRI WKT
+ {
+ auto sourceCRS = factory->createCompoundCRS("7405");
+ auto wkt = sourceCRS->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
+ .get());
+ auto obj =
+ WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
+ auto crs = nn_dynamic_pointer_cast<CompoundCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ auto res = crs->identify(factory);
+ ASSERT_EQ(res.size(), 1U);
+ EXPECT_EQ(res.front().first->getEPSGCode(), 7405);
+ EXPECT_EQ(res.front().second, 100);
+ }
+ // Identify a CompoundCRS whose horizontal and vertical parts are known
+ // but not the composition.
+ {
+ auto obj = createFromUserInput("EPSG:4326+3855", dbContext);
+ auto sourceCRS = nn_dynamic_pointer_cast<CompoundCRS>(obj);
+ ASSERT_TRUE(sourceCRS != nullptr);
+ auto wkt = sourceCRS->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
+ .get());
+ auto obj2 =
+ WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
+ auto crs = nn_dynamic_pointer_cast<CompoundCRS>(obj2);
+ ASSERT_TRUE(crs != nullptr);
+ auto res = crs->identify(factory);
+ ASSERT_EQ(res.size(), 1U);
+ EXPECT_EQ(res.front().first->getEPSGCode(), 0);
+ EXPECT_EQ(res.front().second, 100);
+ const auto &components = res.front().first->componentReferenceSystems();
+ EXPECT_EQ(components[0]->getEPSGCode(), 4326);
+ EXPECT_EQ(components[1]->getEPSGCode(), 3855);
+ }
}
// ---------------------------------------------------------------------------