From 09419f08950688becd05f8b8774e58699b4d8e2a Mon Sep 17 00:00:00 2001 From: Javier Jimenez Shaw Date: Thu, 19 Oct 2023 19:00:44 +0200 Subject: [PATCH] allow LOCAL_CS with 3 axes --- src/iso19111/io.cpp | 2 +- test/unit/test_io.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 721addf972..403733f868 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -2899,7 +2899,7 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */ return CartesianCS::createEastingNorthing(unit); } else if (axisCount == 1) { csTypeCStr = "vertical"; - } else if (axisCount == 2) { + } else if (axisCount == 2 || axisCount == 3) { csTypeCStr = "Cartesian"; } else { throw ParsingException( diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index f878017d8c..85f67cf460 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -5735,6 +5735,26 @@ TEST(wkt_parse, LOCAL_CS_long_two_axis) { // --------------------------------------------------------------------------- +TEST(wkt_parse, LOCAL_CS_long_three_axis) { + auto wkt = "LOCAL_CS[\"Engineering CRS\",\n" + " LOCAL_DATUM[\"Engineering datum\",12345],\n" + " UNIT[\"meter\",1],\n" + " AXIS[\"Easting\",EAST],\n" + " AXIS[\"Northing\",NORTH],\n" + " AXIS[\"Elevation\",UP]]"; + + auto obj = WKTParser().createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_EQ(crs->nameStr(), "Engineering CRS"); + EXPECT_EQ(crs->datum()->nameStr(), "Engineering datum"); + auto cs = crs->coordinateSystem(); + ASSERT_EQ(cs->axisList().size(), 3U); +} + +// --------------------------------------------------------------------------- + TEST(wkt_parse, PDATUM) { auto wkt = "PDATUM[\"Parametric datum\",\n" " ANCHOR[\"my anchor\"]]";