From c3d8ca54fbf0004dbaaa85a4562888a614866507 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 3 Nov 2021 00:22:15 +0100 Subject: BoundCRS WKT import: fix setting of name Name was erroneously set (since 8.2.0) to SOURCECRS. Raised in https://lists.osgeo.org/pipermail/gdal-dev/2021-November/054944.html --- src/iso19111/io.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/iso19111') diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 9ce642e7..5f2472a7 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -1262,7 +1262,8 @@ struct WKTParser::Private { bool removeInverseOf); PropertyMap &buildProperties(const WKTNodeNNPtr &node, - bool removeInverseOf = false); + bool removeInverseOf = false, + bool hasName = true); ObjectDomainPtr buildObjectDomain(const WKTNodeNNPtr &node); @@ -1577,7 +1578,8 @@ IdentifierPtr WKTParser::Private::buildId(const WKTNodeNNPtr &node, // --------------------------------------------------------------------------- PropertyMap &WKTParser::Private::buildProperties(const WKTNodeNNPtr &node, - bool removeInverseOf) { + bool removeInverseOf, + bool hasName) { if (propertyCount_ == MAX_PROPERTY_SIZE) { throw ParsingException("MAX_PROPERTY_SIZE reached"); @@ -1603,7 +1605,7 @@ PropertyMap &WKTParser::Private::buildProperties(const WKTNodeNNPtr &node, } } - if (!nodeChildren.empty()) { + if (hasName && !nodeChildren.empty()) { const auto &nodeName(nodeP->value()); auto name(stripQuotes(nodeChildren[0])); if (removeInverseOf && starts_with(name, "Inverse of ")) { @@ -4670,8 +4672,9 @@ BoundCRSNNPtr WKTParser::Private::buildBoundCRS(const WKTNodeNNPtr &node) { NN_NO_CHECK(targetCRS), nullptr, buildProperties(methodNode), parameters, values, std::vector()); - return BoundCRS::create(buildProperties(node), NN_NO_CHECK(sourceCRS), - NN_NO_CHECK(targetCRS), transformation); + return BoundCRS::create(buildProperties(node, false, false), + NN_NO_CHECK(sourceCRS), NN_NO_CHECK(targetCRS), + transformation); } // --------------------------------------------------------------------------- -- cgit v1.2.3