aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-29 23:32:10 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-09-29 23:32:10 +0200
commit7396d4d96c3646a53b36477e15dafb4db52678cf (patch)
tree0b1f7a43880978c49127620321f1cab6e6239380
parent64c38c2bc12f06ad994cfee57fe9e20f4bdcf272 (diff)
downloadPROJ-7396d4d96c3646a53b36477e15dafb4db52678cf.tar.gz
PROJ-7396d4d96c3646a53b36477e15dafb4db52678cf.zip
CRS::identify(): fix ignoring CS order when identifying a geodetic CRS by a PROJ string with just the ellipsoid
-rw-r--r--src/iso19111/crs.cpp2
-rw-r--r--test/unit/test_crs.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index 7c42c18c..b48f0d70 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -2431,7 +2431,7 @@ GeodeticCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const {
thisDatum->primeMeridian().get(),
util::IComparable::Criterion::EQUIVALENT,
dbContext) &&
- (!l_implicitCS ||
+ (l_implicitCS ||
coordinateSystem()->_isEquivalentTo(
crs->coordinateSystem().get(),
util::IComparable::Criterion::EQUIVALENT,
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp
index f7c82b5e..c9c0c9a1 100644
--- a/test/unit/test_crs.cpp
+++ b/test/unit/test_crs.cpp
@@ -1639,6 +1639,24 @@ TEST(crs, geodeticcrs_identify_db) {
}
{
+ // Test identification from PROJ string with just the ellipsoid
+ auto obj = PROJStringParser().createFromPROJString(
+ "+proj=longlat +ellps=GRS80 +type=crs");
+ auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ auto res = crs->identify(factory);
+ bool foundGDA2020 = false;
+ for (const auto &pair : res) {
+ // one among many others...
+ if (pair.first->getEPSGCode() == 7844) {
+ foundGDA2020 = true;
+ EXPECT_EQ(pair.second, 60);
+ }
+ }
+ EXPECT_TRUE(foundGDA2020);
+ }
+
+ {
// Identify by code, but datum name is an alias of the official one
auto wkt = "GEOGCRS[\"GDA2020\",\n"
" DATUM[\"GDA2020\",\n"