Skip to content

Commit

Permalink
allow LOCAL_CS with 3 axes
Browse files Browse the repository at this point in the history
  • Loading branch information
jjimenezshaw authored and rouault committed Oct 19, 2023
1 parent 91b1f4d commit 09419f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/iso19111/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 20 additions & 0 deletions test/unit/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<EngineeringCRS>(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\"]]";
Expand Down

0 comments on commit 09419f0

Please sign in to comment.