From 932b66a363d18b2ad3ef6640f83d24dd5b4de098 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 24 Jun 2024 23:56:39 +0200 Subject: [PATCH] WKT import: add support for Oracle WKT 'Albers_Conical_Equal_Area' spelling Fixes https://lists.osgeo.org/pipermail/qgis-user/2024-June/054599.html --- src/iso19111/operation/parammappings.cpp | 5 ++++ test/unit/test_io.cpp | 37 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/iso19111/operation/parammappings.cpp b/src/iso19111/operation/parammappings.cpp index 81c8e3cb6b..b2339810f5 100644 --- a/src/iso19111/operation/parammappings.cpp +++ b/src/iso19111/operation/parammappings.cpp @@ -610,6 +610,11 @@ static const MethodMapping projectionMethodMappings[] = { {EPSG_NAME_METHOD_ALBERS_EQUAL_AREA, EPSG_CODE_METHOD_ALBERS_EQUAL_AREA, "Albers_Conic_Equal_Area", "aea", nullptr, paramsAEA_EQDC}, + // Variant used by Oracle WKT: + // https://lists.osgeo.org/pipermail/qgis-user/2024-June/054599.html + {EPSG_NAME_METHOD_ALBERS_EQUAL_AREA, EPSG_CODE_METHOD_ALBERS_EQUAL_AREA, + "Albers_Conical_Equal_Area", "aea", nullptr, paramsAEA_EQDC}, + {EPSG_NAME_METHOD_LAMBERT_CONIC_CONFORMAL_1SP, EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_1SP, "Lambert_Conformal_Conic_1SP", "lcc", nullptr, paramsLCC1SP}, diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 0dc66b5824..cc0cbcaecf 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -8319,6 +8319,43 @@ TEST(wkt_parse, wkt1_oracle) { // --------------------------------------------------------------------------- +TEST(wkt_parse, wkt1_oracle_albers_conical_equal_area) { + // WKT from mdsys.cs_srs Oracle table: + // https://lists.osgeo.org/pipermail/qgis-user/2024-June/054599.html + auto wkt = "PROJCS[\"NAD83 / BC Albers\",GEOGCS[\"NAD83\"," + "DATUM[\"North_American_Datum_1983\"," + "SPHEROID[\"GRS 1980\",6378137,298.257222101," + "AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]]," + "PRIMEM[\"Greenwich\",0]," + "UNIT[\"Decimal Degree\",0.0174532925199433]]," + "PROJECTION[\"Albers_Conical_Equal_Area\"]," + "PARAMETER[\"Latitude_Of_Origin\",45]," + "PARAMETER[\"Central_Meridian\",-126]," + "PARAMETER[\"Standard_Parallel_1\",50]," + "PARAMETER[\"Standard_Parallel_2\",58.5]," + "PARAMETER[\"False_Easting\",1000000]," + "PARAMETER[\"False_Northing\",0]," + "UNIT[\"Meter\",1]," + "AXIS[\"Easting\",EAST]," + "AXIS[\"Northing\",NORTH]]"; + + auto dbContext = DatabaseContext::create(); + auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_EQ(crs->derivingConversion()->method()->nameStr(), + "Albers Equal Area"); + + auto factoryAll = AuthorityFactory::create(dbContext, std::string()); + auto res = crs->identify(factoryAll); + ASSERT_GE(res.size(), 1U); + EXPECT_EQ(res.front().first->getEPSGCode(), 3005); + EXPECT_EQ(res.front().second, 100); +} + +// --------------------------------------------------------------------------- + TEST(wkt_parse, wkt1_lcc_1sp_without_1sp_suffix) { // WKT from Trimble auto wkt = "PROJCS[\"TWM-Madison Co LDP\","