From 5df594d25d8e362a3e4501cb2736dad88a7b0fc6 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 6 Jan 2022 22:43:25 +0100 Subject: proj_get_crs_info_list_from_database(): report PJ_TYPE_GEODETIC_CRS for IAU_2015 -ocentric geodetic CRS (fixes #3012) --- test/unit/test_c_api.cpp | 11 ++++++++--- test/unit/test_factory.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 291d40bc..8a323376 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3797,22 +3797,27 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { params->typesCount = 1; auto type = PJ_TYPE_GEODETIC_CRS; params->types = &type; - auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, - &result_count); + auto list = proj_get_crs_info_list_from_database(m_ctxt, nullptr, + params, &result_count); bool foundGeog2D = false; bool foundGeog3D = false; bool foundGeocentric = false; + bool foundGeodeticCRS = + false; // for now, only -ocentric ellipsoidal IAU CRS for (int i = 0; i < result_count; i++) { foundGeog2D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS; foundGeog3D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_3D_CRS; foundGeocentric |= list[i]->type == PJ_TYPE_GEOCENTRIC_CRS; + foundGeodeticCRS |= list[i]->type == PJ_TYPE_GEODETIC_CRS; EXPECT_TRUE(list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS || list[i]->type == PJ_TYPE_GEOGRAPHIC_3D_CRS || - list[i]->type == PJ_TYPE_GEOCENTRIC_CRS); + list[i]->type == PJ_TYPE_GEOCENTRIC_CRS || + list[i]->type == PJ_TYPE_GEODETIC_CRS); } EXPECT_TRUE(foundGeog2D); EXPECT_TRUE(foundGeog3D); EXPECT_TRUE(foundGeocentric); + EXPECT_TRUE(foundGeodeticCRS); proj_get_crs_list_parameters_destroy(params); proj_crs_info_list_destroy(list); } diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp index a3156faf..9abade09 100644 --- a/test/unit/test_factory.cpp +++ b/test/unit/test_factory.cpp @@ -3570,16 +3570,22 @@ TEST(factory, getCRSInfoList) { bool foundEPSG = false; bool foundIGNF = false; bool found4326 = false; + bool foundIAU_2015_19902 = false; for (const auto &info : list) { foundEPSG |= info.authName == "EPSG"; foundIGNF |= info.authName == "IGNF"; if (info.authName == "EPSG" && info.code == "4326") { found4326 = true; + } else if (info.authName == "IAU_2015" && info.code == "19902") { + foundIAU_2015_19902 = true; + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::GEODETIC_CRS); } } EXPECT_TRUE(foundEPSG); EXPECT_TRUE(foundIGNF); EXPECT_TRUE(found4326); + EXPECT_TRUE(foundIAU_2015_19902); } { auto factory = AuthorityFactory::create(ctxt, "EPSG"); -- cgit v1.2.3