aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-02-06 19:42:04 +0100
committerGitHub <noreply@github.com>2020-02-06 19:42:04 +0100
commit20e9bdea538efea120e4aa48ba4847c28679dc99 (patch)
tree9168a76717b3012b8a17c2d808eea0df6bd2fa97 /test
parent4d0b2e91c52e4ddae04741931dead86cc52492f5 (diff)
parent7fb3ebbf3724050787653afd3f6010760c280a32 (diff)
downloadPROJ-20e9bdea538efea120e4aa48ba4847c28679dc99.tar.gz
PROJ-20e9bdea538efea120e4aa48ba4847c28679dc99.zip
Merge pull request #1916 from rouault/backport_1884_1914_1915
[Backport 6.3] PR #1884 #1914 #1915
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_crs.cpp33
-rw-r--r--test/unit/test_io.cpp18
2 files changed, 51 insertions, 0 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp
index 87efc59d..542d1226 100644
--- a/test/unit/test_crs.cpp
+++ b/test/unit/test_crs.cpp
@@ -1321,6 +1321,7 @@ TEST(crs, geodeticcrs_identify_no_db) {
TEST(crs, geodeticcrs_identify_db) {
auto dbContext = DatabaseContext::create();
auto factory = AuthorityFactory::create(dbContext, "EPSG");
+
{
// No match
auto res =
@@ -1627,6 +1628,26 @@ TEST(crs, geodeticcrs_identify_db) {
EXPECT_TRUE(res.front().first->_isEquivalentTo(
crs.get(), IComparable::Criterion::EQUIVALENT, dbContext));
}
+
+ {
+ // Identify "a" ESRI WKT representation of GDA2020. See #1911
+ auto wkt = "GEOGCS[\"GDA2020\",DATUM[\"D_GDA2020\","
+ "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
+ "PRIMEM[\"Greenwich\",0.0],"
+ "UNIT[\"Degree\",0.017453292519943295]]";
+ auto obj =
+ WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
+ auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+
+ auto allFactory = AuthorityFactory::create(dbContext, std::string());
+ auto res = crs->identify(allFactory);
+ ASSERT_EQ(res.size(), 1U);
+ ASSERT_TRUE(!res.front().first->identifiers().empty());
+ EXPECT_EQ(*res.front().first->identifiers()[0]->codeSpace(), "EPSG");
+ EXPECT_EQ(res.front().first->identifiers()[0]->code(), "7844");
+ EXPECT_EQ(res.front().second, 100);
+ }
}
// ---------------------------------------------------------------------------
@@ -5197,6 +5218,18 @@ TEST(crs, crs_createBoundCRSToWGS84IfPossible) {
dbContext, CoordinateOperationContext::IntermediateCRSUse::NEVER);
EXPECT_EQ(bound, crs);
}
+ {
+ // GDA2020 geocentric
+ auto crs = factory->createCoordinateReferenceSystem("7842");
+ const auto time_before =
+ ::testing::UnitTest::GetInstance()->elapsed_time();
+ crs->createBoundCRSToWGS84IfPossible(
+ dbContext, CoordinateOperationContext::IntermediateCRSUse::
+ IF_NO_DIRECT_TRANSFORMATION);
+ const auto time_after =
+ ::testing::UnitTest::GetInstance()->elapsed_time();
+ EXPECT_LE(time_after - time_before, 500);
+ }
}
// ---------------------------------------------------------------------------
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index d165157d..399cea8c 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -7972,6 +7972,24 @@ TEST(io, projparse_cea_ellipsoidal) {
// ---------------------------------------------------------------------------
+TEST(io, projparse_cea_ellipsoidal_with_k_0) {
+ auto obj = PROJStringParser().createFromPROJString(
+ "+proj=cea +ellps=GRS80 +k_0=0.99 +type=crs");
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ WKTFormatterNNPtr f(WKTFormatter::create());
+ f->simulCurNodeHasId();
+ f->setMultiLine(false);
+ crs->exportToWKT(f.get());
+ auto wkt = f->toString();
+ EXPECT_TRUE(
+ wkt.find("PARAMETER[\"Latitude of 1st standard parallel\",8.1365") !=
+ std::string::npos)
+ << wkt;
+}
+
+// ---------------------------------------------------------------------------
+
TEST(io, projparse_geos_sweep_x) {
auto obj = PROJStringParser().createFromPROJString(
"+proj=geos +sweep=x +h=1 +type=crs");