From 4387332ea628282570d712d5b4b6dccc2ea5e604 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 12 Oct 2021 10:58:55 +0200 Subject: Fix export to WKT1:ESRI of CRS, datum, ellipsoids name that don't have a EPSG equivalent and have parentheses in their name --- src/iso19111/datum.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/iso19111/datum.cpp') diff --git a/src/iso19111/datum.cpp b/src/iso19111/datum.cpp index ebef94a2..7c76061e 100644 --- a/src/iso19111/datum.cpp +++ b/src/iso19111/datum.cpp @@ -363,6 +363,18 @@ void PrimeMeridian::_exportToWKT( aliasFound = true; } } + if (!aliasFound && dbContext) { + auto authFactory = io::AuthorityFactory::create( + NN_NO_CHECK(dbContext), "ESRI"); + aliasFound = + authFactory + ->createObjectsFromName( + l_name, + {io::AuthorityFactory::ObjectType::PRIME_MERIDIAN}, + false // approximateMatch + ) + .size() == 1; + } if (!aliasFound) { l_name = io::WKTFormatter::morphNameToESRI(l_name); } @@ -820,6 +832,18 @@ void Ellipsoid::_exportToWKT( aliasFound = true; } } + if (!aliasFound && dbContext) { + auto authFactory = io::AuthorityFactory::create( + NN_NO_CHECK(dbContext), "ESRI"); + aliasFound = authFactory + ->createObjectsFromName( + l_name, + {io::AuthorityFactory::ObjectType:: + ELLIPSOID}, + false // approximateMatch + ) + .size() == 1; + } if (!aliasFound) { l_name = io::WKTFormatter::morphNameToESRI(l_name); } @@ -1247,6 +1271,18 @@ void GeodeticReferenceFrame::_exportToWKT( } } } + if (!aliasFound && dbContext) { + auto authFactory = io::AuthorityFactory::create( + NN_NO_CHECK(dbContext), "ESRI"); + aliasFound = authFactory + ->createObjectsFromName( + l_name, + {io::AuthorityFactory::ObjectType:: + GEODETIC_REFERENCE_FRAME}, + false // approximateMatch + ) + .size() == 1; + } if (!aliasFound) { l_name = io::WKTFormatter::morphNameToESRI(l_name); if (!starts_with(l_name, "D_")) { @@ -1985,6 +2021,18 @@ void VerticalReferenceFrame::_exportToWKT( aliasFound = true; } } + if (!aliasFound && dbContext) { + auto authFactory = io::AuthorityFactory::create( + NN_NO_CHECK(dbContext), "ESRI"); + aliasFound = authFactory + ->createObjectsFromName( + l_name, + {io::AuthorityFactory::ObjectType:: + VERTICAL_REFERENCE_FRAME}, + false // approximateMatch + ) + .size() == 1; + } if (!aliasFound) { l_name = io::WKTFormatter::morphNameToESRI(l_name); } -- cgit v1.2.3