diff options
| author | PROJ-BOT <59655370+PROJ-BOT@users.noreply.github.com> | 2020-08-07 18:48:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-07 18:48:25 +0200 |
| commit | dd91c93ca44cbe3cf4f6f7c94a8f225aefa4b408 (patch) | |
| tree | 85f8e2e3204c5f5e858f0c4f54b01cb02eaae1a5 | |
| parent | 3b4862042db62381adc505ee7e3e0bbfdcd33663 (diff) | |
| download | PROJ-dd91c93ca44cbe3cf4f6f7c94a8f225aefa4b408.tar.gz PROJ-dd91c93ca44cbe3cf4f6f7c94a8f225aefa4b408.zip | |
ProjectedCRS::identify(): fix to be able to identify EPSG:2154 as a candidate for 'RGF93_Lambert_93' (contributes to fixes https://github.com/qgis/QGIS/issues/32255) (#2316)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
| -rw-r--r-- | src/iso19111/factory.cpp | 4 | ||||
| -rw-r--r-- | test/unit/test_crs.cpp | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index de8e1362..4894085e 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -5642,7 +5642,7 @@ AuthorityFactory::createObjectsFromNameEx( sql += "AND deprecated = 1 "; } if (!approximateMatch) { - sql += "AND name LIKE ? "; + sql += "AND name = ? "; params.push_back(searchedNameWithoutDeprecated); } if (d->hasAuthorityRestriction()) { @@ -5672,7 +5672,7 @@ AuthorityFactory::createObjectsFromNameEx( sql += "AND ov.deprecated = 1 "; } if (!approximateMatch) { - sql += "AND a.alt_name LIKE ? "; + sql += "AND a.alt_name = ? "; params.push_back(searchedNameWithoutDeprecated); } if (d->hasAuthorityRestriction()) { diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index c3530a53..caee0646 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -2672,6 +2672,28 @@ TEST(crs, projectedCRS_identify_db) { EXPECT_EQ(res.front().first->getEPSGCode(), 3035); EXPECT_EQ(res.front().second, 90); } + { + // Test case of https://github.com/qgis/QGIS/issues/32255 + auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT( + "PROJCS[\"RGF93_Lambert_93\",GEOGCS[\"GCS_RGF_1993\"," + "DATUM[\"D_RGF_1993\"," + "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]]," + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Lambert_Conformal_Conic\"]," + "PARAMETER[\"False_Easting\",700000.0]," + "PARAMETER[\"False_Northing\",6600000.0]," + "PARAMETER[\"Central_Meridian\",3.0]," + "PARAMETER[\"Standard_Parallel_1\",44.0]," + "PARAMETER[\"Standard_Parallel_2\",49.0]," + "PARAMETER[\"Latitude_Of_Origin\",46.5],UNIT[\"Meter\",1.0]]"); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + auto factoryAll = AuthorityFactory::create(dbContext, std::string()); + auto res = crs->identify(factoryAll); + ASSERT_GE(res.size(), 1U); + EXPECT_EQ(res.front().first->getEPSGCode(), 2154); + EXPECT_EQ(res.front().second, 90); + } } // --------------------------------------------------------------------------- |
