From 11012ebcc910c4d95d5acbff43f444715ae1ad32 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 14 May 2020 15:11:02 +0200 Subject: WKT/PROJJSON parsing: fix BoundCRS/PROJ4_GRIDS handling for vertical component when vertical CRS has non metre unit (fixes #2217) --- test/unit/test_io.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/unit/test_io.cpp') diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 0570bb7e..e57cb003 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -3442,6 +3442,32 @@ TEST(wkt_parse, WKT1_VERT_DATUM_EXTENSION) { // --------------------------------------------------------------------------- +TEST(wkt_parse, WKT1_VERT_DATUM_EXTENSION_units_ftUS) { + auto wkt = "VERT_CS[\"NAVD88 height (ftUS)\"," + " VERT_DATUM[\"North American Vertical Datum 1988\",2005," + " EXTENSION[\"PROJ4_GRIDS\",\"foo.gtx\"]," + " AUTHORITY[\"EPSG\",\"5103\"]]," + " UNIT[\"US survey foot\",0.304800609601219," + " AUTHORITY[\"EPSG\",\"9003\"]]," + " AXIS[\"Gravity-related height\",UP]," + " AUTHORITY[\"EPSG\",\"6360\"]]"; + + auto obj = WKTParser().createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_EQ(crs->transformation()->nameStr(), + "NAVD88 height to WGS84 ellipsoidal height"); // no (ftUS) + auto sourceTransformationCRS = crs->transformation()->sourceCRS(); + auto sourceTransformationVertCRS = + nn_dynamic_pointer_cast(sourceTransformationCRS); + EXPECT_EQ( + sourceTransformationVertCRS->coordinateSystem()->axisList()[0]->unit(), + UnitOfMeasure::METRE); +} + +// --------------------------------------------------------------------------- + TEST(wkt_parse, WKT1_DATUM_EXTENSION) { auto wkt = "PROJCS[\"unnamed\",\n" -- cgit v1.2.3