aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-24 14:52:46 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-01-24 14:52:46 +0100
commit9db95ecde7ffa275697ce4921437bc8f7d475d25 (patch)
tree0ed535f82f3d48c2568246663361b824f257a238 /test/unit
parent15ed5651019f5438a1dddab0c30f21733a0e1e97 (diff)
downloadPROJ-9db95ecde7ffa275697ce4921437bc8f7d475d25.tar.gz
PROJ-9db95ecde7ffa275697ce4921437bc8f7d475d25.zip
createObjectsFromName(): use alias as fallback only
Fixes a regression of 6.3.0 found when creating with GDAL a TIFF with a Geographic3D CRS. As TIFF must also encode the Geographic2D CRS, the code of the Geographic2D CRS is searched from the name of the Geographic3D CRS. When doing createObjectsFromName( "ETRS89", {AuthorityFactory::ObjectType::GEOGRAPHIC_2D_CRS}, false, 1), the result returned was not EPSG:4258 as expected, but EPSG:4173 IRENET95 which is registered as an alias of ETRS89. So sort results such that non-alias results are returned first.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_factory.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp
index 33b72efd..d49db5bf 100644
--- a/test/unit/test_factory.cpp
+++ b/test/unit/test_factory.cpp
@@ -2869,6 +2869,16 @@ TEST(factory, createObjectsFromName) {
factory->createObjectsFromName("i_dont_exist", {type}, false, 1);
}
factory->createObjectsFromName("i_dont_exist", types, false, 1);
+
+ {
+ auto res = factoryEPSG->createObjectsFromName(
+ "ETRS89", {AuthorityFactory::ObjectType::GEOGRAPHIC_2D_CRS}, false,
+ 1);
+ EXPECT_EQ(res.size(), 1U);
+ if (!res.empty()) {
+ EXPECT_EQ(res.front()->getEPSGCode(), 4258);
+ }
+ }
}
// ---------------------------------------------------------------------------