Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKT import: add support for Oracle WKT 'Albers_Conical_Equal_Area' spelling #4181

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/iso19111/operation/parammappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
37 changes: 37 additions & 0 deletions test/unit/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProjectedCRS>(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\","
Expand Down