diff --git a/src/iso19111/coordinatesystem.cpp b/src/iso19111/coordinatesystem.cpp index f80ecf3802..1d144df191 100644 --- a/src/iso19111/coordinatesystem.cpp +++ b/src/iso19111/coordinatesystem.cpp @@ -1356,8 +1356,9 @@ ParametricCS::create(const util::PropertyMap &properties, // --------------------------------------------------------------------------- AxisDirection::AxisDirection(const std::string &nameIn) : CodeList(nameIn) { - assert(registry.find(nameIn) == registry.end()); - registry[nameIn] = this; + auto lowerName = tolower(nameIn); + assert(registry.find(lowerName) == registry.end()); + registry[lowerName] = this; } // --------------------------------------------------------------------------- @@ -1365,7 +1366,7 @@ AxisDirection::AxisDirection(const std::string &nameIn) : CodeList(nameIn) { //! @cond Doxygen_Suppress const AxisDirection * AxisDirection::valueOf(const std::string &nameIn) noexcept { - auto iter = registry.find(nameIn); + auto iter = registry.find(tolower(nameIn)); if (iter == registry.end()) return nullptr; return iter->second; @@ -1375,8 +1376,9 @@ AxisDirection::valueOf(const std::string &nameIn) noexcept { // --------------------------------------------------------------------------- RangeMeaning::RangeMeaning(const std::string &nameIn) : CodeList(nameIn) { - assert(registry.find(nameIn) == registry.end()); - registry[nameIn] = this; + auto lowerName = tolower(nameIn); + assert(registry.find(lowerName) == registry.end()); + registry[lowerName] = this; } // --------------------------------------------------------------------------- @@ -1387,7 +1389,7 @@ RangeMeaning::RangeMeaning() : CodeList(std::string()) {} //! @cond Doxygen_Suppress const RangeMeaning *RangeMeaning::valueOf(const std::string &nameIn) noexcept { - auto iter = registry.find(nameIn); + auto iter = registry.find(tolower(nameIn)); if (iter == registry.end()) return nullptr; return iter->second; @@ -1399,14 +1401,15 @@ const RangeMeaning *RangeMeaning::valueOf(const std::string &nameIn) noexcept { AxisDirectionWKT1::AxisDirectionWKT1(const std::string &nameIn) : CodeList(nameIn) { - assert(registry.find(nameIn) == registry.end()); - registry[nameIn] = this; + auto lowerName = tolower(nameIn); + assert(registry.find(lowerName) == registry.end()); + registry[lowerName] = this; } // --------------------------------------------------------------------------- const AxisDirectionWKT1 *AxisDirectionWKT1::valueOf(const std::string &nameIn) { - auto iter = registry.find(nameIn); + auto iter = registry.find(tolower(nameIn)); if (iter == registry.end()) return nullptr; return iter->second; diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 2aa4432f7b..0c9a81a4eb 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -2634,9 +2634,6 @@ WKTParser::Private::buildAxis(const WKTNodeNNPtr &node, direction = &AxisDirection::GEOCENTRIC_Z; } else if (dirString == AxisDirectionWKT1::OTHER.toString()) { direction = &AxisDirection::UNSPECIFIED; - } else if (!direction && - AxisDirectionWKT1::valueOf(toupper(dirString)) != nullptr) { - direction = AxisDirection::valueOf(tolower(dirString)); } if (!direction) { diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 4815b8d183..2e7fe0c504 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -1039,7 +1039,8 @@ TEST(wkt_parse, wkt2_geocentric) { " ID[\"EPSG\",9122]],\n" " ID[\"EPSG\",8901]],\n" " CS[Cartesian,3],\n" - " AXIS[\"(X)\",geocentricX,\n" + // nominal value is 'geocentricX' with g lower case. + " AXIS[\"(X)\",GeocentricX,\n" " ORDER[1],\n" " LENGTHUNIT[\"metre\",1,\n" " ID[\"EPSG\",9001]]],\n" @@ -2468,7 +2469,8 @@ TEST(wkt_parse, cs_with_AXISMINVAL_AXISMAXVAL_RANGEMEANING) { " ANGLEUNIT[\"degree\",0.0174532925199433],\n" " AXISMINVALUE[0],\n" " AXISMAXVALUE[360],\n" - " RANGEMEANING[wraparound]]]"; + // nominal value is 'wraparound' lower case + " RANGEMEANING[wrapAround]]]"; auto obj = WKTParser().createFromWKT(wkt); auto crs = nn_dynamic_pointer_cast(obj); ASSERT_TRUE(crs != nullptr); @@ -2492,7 +2494,7 @@ TEST(wkt_parse, cs_with_AXISMINVAL_AXISMAXVAL_RANGEMEANING) { EXPECT_EQ( crs->exportToWKT( WKTFormatter::create(WKTFormatter::Convention::WKT2_2019).get()), - wkt); + replaceAll(wkt, "wrapAround", "wraparound")); } // ---------------------------------------------------------------------------