From 5ddddfac622f40a4de920460b64e88e7b9cb5b68 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 12 Mar 2021 22:43:42 +0100 Subject: Add C/C++ API to get SQL statements to insert a CRS into database --- src/iso19111/crs.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/iso19111/crs.cpp') diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 73c61e2c..65f2087d 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -4829,7 +4829,14 @@ CompoundCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { const auto &thisName(nameStr()); const auto &components = componentReferenceSystems(); - const bool l_implicitCS = components[0]->hasImplicitCS(); + bool l_implicitCS = components[0]->hasImplicitCS(); + if (!l_implicitCS) { + const auto projCRS = + dynamic_cast(components[0].get()); + if (projCRS) { + l_implicitCS = projCRS->baseCRS()->hasImplicitCS(); + } + } const auto crsCriterion = l_implicitCS ? util::IComparable::Criterion::EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS @@ -4949,6 +4956,13 @@ CompoundCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { } res.sort(lambdaSort); + + // If there's a single candidate at 90% confidence with same name, + // then promote it to 100% + if (res.size() == 1 && res.front().second == 90 && + thisName == res.front().first->nameStr()) { + res.front().second = 100; + } } // If we didn't find a match for the CompoundCRS, check if the -- cgit v1.2.3