From ab5876438a650a8f4092e39f901b6fdf346e9a0e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 15 Oct 2023 17:46:54 +0200 Subject: [PATCH] Cleanup: use constants for strings of WKT coordinate system types --- include/proj/coordinatesystem.hpp | 48 ++++++++++++++--- src/iso19111/coordinatesystem.cpp | 6 +-- src/iso19111/factory.cpp | 25 +++++---- src/iso19111/io.cpp | 89 ++++++++++++++++--------------- 4 files changed, 106 insertions(+), 62 deletions(-) diff --git a/include/proj/coordinatesystem.hpp b/include/proj/coordinatesystem.hpp index 0dc0702e23..a26f4c1719 100644 --- a/include/proj/coordinatesystem.hpp +++ b/include/proj/coordinatesystem.hpp @@ -361,13 +361,16 @@ class PROJ_GCC_DLL SphericalCS final : public CoordinateSystem { const CoordinateSystemAxisNNPtr &axis1, const CoordinateSystemAxisNNPtr &axis2); + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = "spherical"; + protected: PROJ_INTERNAL explicit SphericalCS( const std::vector &axisIn); INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "spherical"; + return WKT2_TYPE; } private: @@ -422,6 +425,9 @@ class PROJ_GCC_DLL EllipsoidalCS final : public CoordinateSystem { const common::UnitOfMeasure &angularUnit, const common::UnitOfMeasure &linearUnit); + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = "ellipsoidal"; + //! @cond Doxygen_Suppress /** \brief Typical axis order. */ @@ -454,7 +460,7 @@ class PROJ_GCC_DLL EllipsoidalCS final : public CoordinateSystem { INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "ellipsoidal"; + return WKT2_TYPE; } protected: @@ -490,6 +496,9 @@ class PROJ_GCC_DLL VerticalCS final : public CoordinateSystem { PROJ_DLL static VerticalCSNNPtr createGravityRelatedHeight(const common::UnitOfMeasure &unit); + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = "vertical"; + PROJ_PRIVATE : //! @cond Doxygen_Suppress PROJ_INTERNAL VerticalCSNNPtr @@ -502,7 +511,7 @@ class PROJ_GCC_DLL VerticalCS final : public CoordinateSystem { INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "vertical"; + return WKT2_TYPE; } private: @@ -560,6 +569,10 @@ class PROJ_GCC_DLL CartesianCS final : public CoordinateSystem { PROJ_DLL static CartesianCSNNPtr createGeocentric(const common::UnitOfMeasure &unit); + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = + "Cartesian"; // uppercase is intended + PROJ_PRIVATE : //! @cond Doxygen_Suppress PROJ_INTERNAL CartesianCSNNPtr @@ -573,7 +586,7 @@ class PROJ_GCC_DLL CartesianCS final : public CoordinateSystem { INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "Cartesian"; // uppercase is intended + return WKT2_TYPE; } private: @@ -600,6 +613,9 @@ class PROJ_GCC_DLL AffineCS final : public CoordinateSystem { PROJ_DLL ~AffineCS() override; //! @endcond + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = "affine"; + PROJ_DLL static AffineCSNNPtr create(const util::PropertyMap &properties, const CoordinateSystemAxisNNPtr &axis1, @@ -623,7 +639,7 @@ class PROJ_GCC_DLL AffineCS final : public CoordinateSystem { INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "affine"; + return WKT2_TYPE; } private: @@ -655,13 +671,16 @@ class PROJ_GCC_DLL OrdinalCS final : public CoordinateSystem { create(const util::PropertyMap &properties, const std::vector &axisIn); + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = "ordinal"; + protected: PROJ_INTERNAL explicit OrdinalCS( const std::vector &axisIn); INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "ordinal"; + return WKT2_TYPE; } private: @@ -691,13 +710,16 @@ class PROJ_GCC_DLL ParametricCS final : public CoordinateSystem { create(const util::PropertyMap &properties, const CoordinateSystemAxisNNPtr &axisIn); + /** Value of getWKT2Type() */ + static constexpr const char *WKT2_TYPE = "parametric"; + protected: PROJ_INTERNAL explicit ParametricCS( const std::vector &axisIn); INLINED_MAKE_SHARED PROJ_INTERNAL std::string getWKT2Type(bool) const override { - return "parametric"; + return WKT2_TYPE; } private: @@ -725,6 +747,9 @@ class PROJ_GCC_DLL TemporalCS : public CoordinateSystem { PROJ_DLL ~TemporalCS() override; //! @endcond + /** WKT2:2015 type */ + static constexpr const char *WKT2_2015_TYPE = "temporal"; + protected: PROJ_INTERNAL explicit TemporalCS(const CoordinateSystemAxisNNPtr &axis); INLINED_MAKE_SHARED @@ -763,6 +788,9 @@ class PROJ_GCC_DLL DateTimeTemporalCS final : public TemporalCS { create(const util::PropertyMap &properties, const CoordinateSystemAxisNNPtr &axis); + /** WKT2:2019 type */ + static constexpr const char *WKT2_2019_TYPE = "TemporalDateTime"; + protected: PROJ_INTERNAL explicit DateTimeTemporalCS( const CoordinateSystemAxisNNPtr &axis); @@ -799,6 +827,9 @@ class PROJ_GCC_DLL TemporalCountCS final : public TemporalCS { create(const util::PropertyMap &properties, const CoordinateSystemAxisNNPtr &axis); + /** WKT2:2019 type */ + static constexpr const char *WKT2_2019_TYPE = "TemporalCount"; + protected: PROJ_INTERNAL explicit TemporalCountCS( const CoordinateSystemAxisNNPtr &axis); @@ -835,6 +866,9 @@ class PROJ_GCC_DLL TemporalMeasureCS final : public TemporalCS { create(const util::PropertyMap &properties, const CoordinateSystemAxisNNPtr &axis); + /** WKT2:2019 type */ + static constexpr const char *WKT2_2019_TYPE = "TemporalMeasure"; + protected: PROJ_INTERNAL explicit TemporalMeasureCS( const CoordinateSystemAxisNNPtr &axis); diff --git a/src/iso19111/coordinatesystem.cpp b/src/iso19111/coordinatesystem.cpp index d7cdcb643d..f8c455ddfe 100644 --- a/src/iso19111/coordinatesystem.cpp +++ b/src/iso19111/coordinatesystem.cpp @@ -1527,7 +1527,7 @@ DateTimeTemporalCS::create(const util::PropertyMap &properties, // --------------------------------------------------------------------------- std::string DateTimeTemporalCS::getWKT2Type(bool use2019Keywords) const { - return use2019Keywords ? "TemporalDateTime" : "temporal"; + return use2019Keywords ? WKT2_2019_TYPE : WKT2_2015_TYPE; } // --------------------------------------------------------------------------- @@ -1560,7 +1560,7 @@ TemporalCountCS::create(const util::PropertyMap &properties, // --------------------------------------------------------------------------- std::string TemporalCountCS::getWKT2Type(bool use2019Keywords) const { - return use2019Keywords ? "TemporalCount" : "temporal"; + return use2019Keywords ? WKT2_2019_TYPE : WKT2_2015_TYPE; } // --------------------------------------------------------------------------- @@ -1593,7 +1593,7 @@ TemporalMeasureCS::create(const util::PropertyMap &properties, // --------------------------------------------------------------------------- std::string TemporalMeasureCS::getWKT2Type(bool use2019Keywords) const { - return use2019Keywords ? "TemporalMeasure" : "temporal"; + return use2019Keywords ? WKT2_2019_TYPE : WKT2_2015_TYPE; } } // namespace cs diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index cd4439c892..03356a1c19 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -115,6 +115,13 @@ namespace io { #define GEOG_3D_SINGLE_QUOTED "'geographic 3D'" #define GEOCENTRIC_SINGLE_QUOTED "'geocentric'" +// Coordinate system types +constexpr const char *CS_TYPE_ELLIPSOIDAL = "ellipsoidal"; +constexpr const char *CS_TYPE_CARTESIAN = "Cartesian"; // uppercase intended +constexpr const char *CS_TYPE_SPHERICAL = "spherical"; +constexpr const char *CS_TYPE_VERTICAL = "vertical"; +constexpr const char *CS_TYPE_ORDINAL = "ordinal"; + // See data/sql/metadata.sql for the semantics of those constants constexpr int DATABASE_LAYOUT_VERSION_MAJOR = 1; // If the code depends on the new additions, then DATABASE_LAYOUT_VERSION_MINOR @@ -1605,11 +1612,11 @@ identifyFromNameOrCode(const DatabaseContextNNPtr &dbContext, static const char *getCSDatabaseType(const cs::CoordinateSystemNNPtr &obj) { if (dynamic_cast(obj.get())) { - return "ellipsoidal"; + return CS_TYPE_ELLIPSOIDAL; } else if (dynamic_cast(obj.get())) { - return "Cartesian"; + return CS_TYPE_CARTESIAN; } else if (dynamic_cast(obj.get())) { - return "vertical"; + return CS_TYPE_VERTICAL; } return nullptr; } @@ -4917,7 +4924,7 @@ AuthorityFactory::createCoordinateSystem(const std::string &code) const { const auto &orientation = row[2]; const auto &uom_auth_name = row[3]; const auto &uom_code = row[4]; - if (uom_auth_name.empty() && csType != "ordinal") { + if (uom_auth_name.empty() && csType != CS_TYPE_ORDINAL) { throw FactoryException("no unit of measure for an axis is only " "supported for ordinatal CS"); } @@ -4966,7 +4973,7 @@ AuthorityFactory::createCoordinateSystem(const std::string &code) const { auto props = util::PropertyMap() .set(metadata::Identifier::CODESPACE_KEY, d->authority()) .set(metadata::Identifier::CODE_KEY, code); - if (csType == "ellipsoidal") { + if (csType == CS_TYPE_ELLIPSOIDAL) { if (axisList.size() == 2) { return cacheAndRet( cs::EllipsoidalCS::create(props, axisList[0], axisList[1])); @@ -4977,7 +4984,7 @@ AuthorityFactory::createCoordinateSystem(const std::string &code) const { } throw FactoryException("invalid number of axis for EllipsoidalCS"); } - if (csType == "Cartesian") { + if (csType == CS_TYPE_CARTESIAN) { if (axisList.size() == 2) { return cacheAndRet( cs::CartesianCS::create(props, axisList[0], axisList[1])); @@ -4988,7 +4995,7 @@ AuthorityFactory::createCoordinateSystem(const std::string &code) const { } throw FactoryException("invalid number of axis for CartesianCS"); } - if (csType == "spherical") { + if (csType == CS_TYPE_SPHERICAL) { if (axisList.size() == 2) { return cacheAndRet( cs::SphericalCS::create(props, axisList[0], axisList[1])); @@ -4999,13 +5006,13 @@ AuthorityFactory::createCoordinateSystem(const std::string &code) const { } throw FactoryException("invalid number of axis for SphericalCS"); } - if (csType == "vertical") { + if (csType == CS_TYPE_VERTICAL) { if (axisList.size() == 1) { return cacheAndRet(cs::VerticalCS::create(props, axisList[0])); } throw FactoryException("invalid number of axis for VerticalCS"); } - if (csType == "ordinal") { + if (csType == CS_TYPE_ORDINAL) { return cacheAndRet(cs::OrdinalCS::create(props, axisList)); } throw FactoryException("unhandled coordinate system type: " + csType); diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index be2d10f036..2172dafbd2 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -2776,7 +2776,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ const char *csTypeCStr = ""; const auto &parentNodeName = parentNode->GP()->value(); if (ci_equal(parentNodeName, WKTConstants::GEOCCS)) { - csTypeCStr = "Cartesian"; + csTypeCStr = CartesianCS::WKT2_TYPE; isGeocentric = true; if (axisCount == 0) { auto unit = @@ -2787,7 +2787,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ return CartesianCS::createGeocentric(unit); } } else if (ci_equal(parentNodeName, WKTConstants::GEOGCS)) { - csTypeCStr = "Ellipsoidal"; + csTypeCStr = EllipsoidalCS::WKT2_TYPE; if (axisCount == 0) { // Missing axis with GEOGCS ? Presumably Long/Lat order // implied @@ -2812,7 +2812,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ } } else if (ci_equal(parentNodeName, WKTConstants::BASEGEODCRS) || ci_equal(parentNodeName, WKTConstants::BASEGEOGCRS)) { - csTypeCStr = "Ellipsoidal"; + csTypeCStr = EllipsoidalCS::WKT2_TYPE; if (axisCount == 0) { auto unit = buildUnitInSubNode(parentNode, UnitOfMeasure::Type::ANGULAR); @@ -2825,7 +2825,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ } else if (ci_equal(parentNodeName, WKTConstants::PROJCS) || ci_equal(parentNodeName, WKTConstants::BASEPROJCRS) || ci_equal(parentNodeName, WKTConstants::BASEENGCRS)) { - csTypeCStr = "Cartesian"; + csTypeCStr = CartesianCS::WKT2_TYPE; if (axisCount == 0) { auto unit = buildUnitInSubNode(parentNode, UnitOfMeasure::Type::LINEAR); @@ -2841,7 +2841,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ } else if (ci_equal(parentNodeName, WKTConstants::VERT_CS) || ci_equal(parentNodeName, WKTConstants::VERTCS) || ci_equal(parentNodeName, WKTConstants::BASEVERTCRS)) { - csTypeCStr = "vertical"; + csTypeCStr = VerticalCS::WKT2_TYPE; bool downDirection = false; if (ci_equal(parentNodeName, WKTConstants::VERTCS)) // ESRI @@ -2901,15 +2901,15 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ } return CartesianCS::createEastingNorthing(unit); } else if (axisCount == 1) { - csTypeCStr = "vertical"; + csTypeCStr = VerticalCS::WKT2_TYPE; } else if (axisCount == 2) { - csTypeCStr = "Cartesian"; + csTypeCStr = CartesianCS::WKT2_TYPE; } else { throw ParsingException( "buildCS: unexpected AXIS count for LOCAL_CS"); } } else if (ci_equal(parentNodeName, WKTConstants::BASEPARAMCRS)) { - csTypeCStr = "parametric"; + csTypeCStr = ParametricCS::WKT2_TYPE; if (axisCount == 0) { auto unit = buildUnitInSubNode(parentNode, UnitOfMeasure::Type::LINEAR); @@ -2925,7 +2925,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ std::string(), AxisDirection::UNSPECIFIED, unit)); } } else if (ci_equal(parentNodeName, WKTConstants::BASETIMECRS)) { - csTypeCStr = "temporal"; + csTypeCStr = TemporalCS::WKT2_2015_TYPE; if (axisCount == 0) { auto unit = buildUnitInSubNode(parentNode, UnitOfMeasure::Type::TIME); @@ -2957,16 +2957,19 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ } const auto unitType = - ci_equal(csType, "ellipsoidal") ? UnitOfMeasure::Type::ANGULAR - : ci_equal(csType, "ordinal") ? UnitOfMeasure::Type::NONE - : ci_equal(csType, "parametric") ? UnitOfMeasure::Type::PARAMETRIC - : ci_equal(csType, "Cartesian") || ci_equal(csType, "vertical") || - ci_equal(csType, "affine") + ci_equal(csType, EllipsoidalCS::WKT2_TYPE) + ? UnitOfMeasure::Type::ANGULAR + : ci_equal(csType, OrdinalCS::WKT2_TYPE) ? UnitOfMeasure::Type::NONE + : ci_equal(csType, ParametricCS::WKT2_TYPE) + ? UnitOfMeasure::Type::PARAMETRIC + : ci_equal(csType, CartesianCS::WKT2_TYPE) || + ci_equal(csType, VerticalCS::WKT2_TYPE) || + ci_equal(csType, AffineCS::WKT2_TYPE) ? UnitOfMeasure::Type::LINEAR - : (ci_equal(csType, "temporal") || - ci_equal(csType, "TemporalDateTime") || - ci_equal(csType, "TemporalCount") || - ci_equal(csType, "TemporalMeasure")) + : (ci_equal(csType, TemporalCS::WKT2_2015_TYPE) || + ci_equal(csType, DateTimeTemporalCS::WKT2_2019_TYPE) || + ci_equal(csType, TemporalCountCS::WKT2_2019_TYPE) || + ci_equal(csType, TemporalMeasureCS::WKT2_2019_TYPE)) ? UnitOfMeasure::Type::TIME : UnitOfMeasure::Type::UNKNOWN; UnitOfMeasure unit = buildUnitInSubNode(parentNode, unitType); @@ -2979,32 +2982,32 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ } const PropertyMap &csMap = emptyPropertyMap; - if (ci_equal(csType, "ellipsoidal")) { + if (ci_equal(csType, EllipsoidalCS::WKT2_TYPE)) { if (axisCount == 2) { return EllipsoidalCS::create(csMap, axisList[0], axisList[1]); } else if (axisCount == 3) { return EllipsoidalCS::create(csMap, axisList[0], axisList[1], axisList[2]); } - } else if (ci_equal(csType, "Cartesian")) { + } else if (ci_equal(csType, CartesianCS::WKT2_TYPE)) { if (axisCount == 2) { return CartesianCS::create(csMap, axisList[0], axisList[1]); } else if (axisCount == 3) { return CartesianCS::create(csMap, axisList[0], axisList[1], axisList[2]); } - } else if (ci_equal(csType, "affine")) { + } else if (ci_equal(csType, AffineCS::WKT2_TYPE)) { if (axisCount == 2) { return AffineCS::create(csMap, axisList[0], axisList[1]); } else if (axisCount == 3) { return AffineCS::create(csMap, axisList[0], axisList[1], axisList[2]); } - } else if (ci_equal(csType, "vertical")) { + } else if (ci_equal(csType, VerticalCS::WKT2_TYPE)) { if (axisCount == 1) { return VerticalCS::create(csMap, axisList[0]); } - } else if (ci_equal(csType, "spherical")) { + } else if (ci_equal(csType, SphericalCS::WKT2_TYPE)) { if (axisCount == 2) { // Extension to ISO19111 to support (planet)-ocentric CS with // geocentric latitude @@ -3013,13 +3016,13 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ return SphericalCS::create(csMap, axisList[0], axisList[1], axisList[2]); } - } else if (ci_equal(csType, "ordinal")) { // WKT2-2019 + } else if (ci_equal(csType, OrdinalCS::WKT2_TYPE)) { // WKT2-2019 return OrdinalCS::create(csMap, axisList); - } else if (ci_equal(csType, "parametric")) { + } else if (ci_equal(csType, ParametricCS::WKT2_TYPE)) { if (axisCount == 1) { return ParametricCS::create(csMap, axisList[0]); } - } else if (ci_equal(csType, "temporal")) { // WKT2-2015 + } else if (ci_equal(csType, TemporalCS::WKT2_2015_TYPE)) { if (axisCount == 1) { if (isNull( parentNode->GP()->lookForChild(WKTConstants::TIMEUNIT)) && @@ -3031,15 +3034,15 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ return TemporalMeasureCS::create(csMap, axisList[0]); } } - } else if (ci_equal(csType, "TemporalDateTime")) { // WKT2-2019 + } else if (ci_equal(csType, DateTimeTemporalCS::WKT2_2019_TYPE)) { if (axisCount == 1) { return DateTimeTemporalCS::create(csMap, axisList[0]); } - } else if (ci_equal(csType, "TemporalCount")) { // WKT2-2019 + } else if (ci_equal(csType, TemporalCountCS::WKT2_2019_TYPE)) { if (axisCount == 1) { return TemporalCountCS::create(csMap, axisList[0]); } - } else if (ci_equal(csType, "TemporalMeasure")) { // WKT2-2019 + } else if (ci_equal(csType, TemporalMeasureCS::WKT2_2019_TYPE)) { if (axisCount == 1) { return TemporalMeasureCS::create(csMap, axisList[0]); } @@ -4589,7 +4592,7 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) { } } if (!cartesianCS) { - ThrowNotExpectedCSType("Cartesian"); + ThrowNotExpectedCSType(CartesianCS::WKT2_TYPE); } if (cartesianCS->axisList().size() == 3 && @@ -4842,7 +4845,7 @@ CRSNNPtr WKTParser::Private::buildVerticalCRS(const WKTNodeNNPtr &node) { auto verticalCS = nn_dynamic_pointer_cast( buildCS(csNode, node, UnitOfMeasure::NONE)); if (!verticalCS) { - ThrowNotExpectedCSType("vertical"); + ThrowNotExpectedCSType(VerticalCS::WKT2_TYPE); } if (vdatum && vdatum->getWKT1DatumType() == "2002" && @@ -5179,7 +5182,7 @@ WKTParser::Private::buildTemporalCS(const WKTNodeNNPtr &parentNode) { auto cs = buildCS(csNode, parentNode, UnitOfMeasure::NONE); auto temporalCS = nn_dynamic_pointer_cast(cs); if (!temporalCS) { - ThrowNotExpectedCSType("temporal"); + ThrowNotExpectedCSType(TemporalCS::WKT2_2015_TYPE); } return NN_NO_CHECK(temporalCS); } @@ -5304,7 +5307,7 @@ WKTParser::Private::buildParametricCS(const WKTNodeNNPtr &parentNode) { auto cs = buildCS(csNode, parentNode, UnitOfMeasure::NONE); auto parametricCS = nn_dynamic_pointer_cast(cs); if (!parametricCS) { - ThrowNotExpectedCSType("parametric"); + ThrowNotExpectedCSType(ParametricCS::WKT2_TYPE); } return NN_NO_CHECK(parametricCS); } @@ -6804,7 +6807,7 @@ CoordinateSystemNNPtr JSONParser::buildCS(const json &j) { } const PropertyMap &csMap = emptyPropertyMap; const auto axisCount = axisList.size(); - if (subtype == "ellipsoidal") { + if (subtype == EllipsoidalCS::WKT2_TYPE) { if (axisCount == 2) { return EllipsoidalCS::create(csMap, axisList[0], axisList[1]); } @@ -6814,7 +6817,7 @@ CoordinateSystemNNPtr JSONParser::buildCS(const json &j) { } throw ParsingException("Expected 2 or 3 axis"); } - if (subtype == "Cartesian") { + if (subtype == CartesianCS::WKT2_TYPE) { if (axisCount == 2) { return CartesianCS::create(csMap, axisList[0], axisList[1]); } @@ -6824,7 +6827,7 @@ CoordinateSystemNNPtr JSONParser::buildCS(const json &j) { } throw ParsingException("Expected 2 or 3 axis"); } - if (subtype == "affine") { + if (subtype == AffineCS::WKT2_TYPE) { if (axisCount == 2) { return AffineCS::create(csMap, axisList[0], axisList[1]); } @@ -6834,13 +6837,13 @@ CoordinateSystemNNPtr JSONParser::buildCS(const json &j) { } throw ParsingException("Expected 2 or 3 axis"); } - if (subtype == "vertical") { + if (subtype == VerticalCS::WKT2_TYPE) { if (axisCount == 1) { return VerticalCS::create(csMap, axisList[0]); } throw ParsingException("Expected 1 axis"); } - if (subtype == "spherical") { + if (subtype == SphericalCS::WKT2_TYPE) { if (axisCount == 2) { // Extension to ISO19111 to support (planet)-ocentric CS with // geocentric latitude @@ -6851,28 +6854,28 @@ CoordinateSystemNNPtr JSONParser::buildCS(const json &j) { } throw ParsingException("Expected 2 or 3 axis"); } - if (subtype == "ordinal") { + if (subtype == OrdinalCS::WKT2_TYPE) { return OrdinalCS::create(csMap, axisList); } - if (subtype == "parametric") { + if (subtype == ParametricCS::WKT2_TYPE) { if (axisCount == 1) { return ParametricCS::create(csMap, axisList[0]); } throw ParsingException("Expected 1 axis"); } - if (subtype == "TemporalDateTime") { + if (subtype == DateTimeTemporalCS::WKT2_2019_TYPE) { if (axisCount == 1) { return DateTimeTemporalCS::create(csMap, axisList[0]); } throw ParsingException("Expected 1 axis"); } - if (subtype == "TemporalCount") { + if (subtype == TemporalCountCS::WKT2_2019_TYPE) { if (axisCount == 1) { return TemporalCountCS::create(csMap, axisList[0]); } throw ParsingException("Expected 1 axis"); } - if (subtype == "TemporalMeasure") { + if (subtype == TemporalMeasureCS::WKT2_2019_TYPE) { if (axisCount == 1) { return TemporalMeasureCS::create(csMap, axisList[0]); }