diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-01-24 14:52:46 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-01-24 14:52:46 +0100 |
| commit | 9db95ecde7ffa275697ce4921437bc8f7d475d25 (patch) | |
| tree | 0ed535f82f3d48c2568246663361b824f257a238 /src/iso19111/factory.cpp | |
| parent | 15ed5651019f5438a1dddab0c30f21733a0e1e97 (diff) | |
| download | PROJ-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 'src/iso19111/factory.cpp')
| -rw-r--r-- | src/iso19111/factory.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index 2a4ad3e8..7e680d31 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -5214,9 +5214,9 @@ AuthorityFactory::createObjectsFromName( } std::string sql( - "SELECT table_name, auth_name, code, name, deprecated FROM (" - "SELECT table_name, auth_name, code, name, deprecated FROM object_view " - "WHERE "); + "SELECT table_name, auth_name, code, name, deprecated, is_alias FROM (" + "SELECT table_name, auth_name, code, name, deprecated, 0 as is_alias " + "FROM object_view WHERE "); if (deprecated) { sql += "deprecated = 1 AND "; } @@ -5348,7 +5348,7 @@ AuthorityFactory::createObjectsFromName( sql += " UNION SELECT ov.table_name AS table_name, " "ov.auth_name AS auth_name, " "ov.code AS code, a.alt_name AS name, " - "ov.deprecated AS deprecated FROM object_view ov " + "ov.deprecated AS deprecated, 1 as is_alias FROM object_view ov " "JOIN alias_name a ON ov.table_name = a.table_name AND " "ov.auth_name = a.auth_name AND ov.code = a.code WHERE "; if (deprecated) { @@ -5364,7 +5364,7 @@ AuthorityFactory::createObjectsFromName( } sql += getTableNameConstraint("ov.table_name"); - sql += ") ORDER BY deprecated, length(name), name"; + sql += ") ORDER BY deprecated, is_alias, length(name), name"; if (limitResultCount > 0 && limitResultCount < static_cast<size_t>(std::numeric_limits<int>::max()) && |
