diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-07-01 14:14:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-01 14:14:24 +0200 |
| commit | c99cfa8ee743251faba9bc04ee5cf5a6010359eb (patch) | |
| tree | 6043af1187f971fa1af9aa7a064b43be18bfc22e /test | |
| parent | 42cd77130675504b6a1db5b128b41c8d5df19f9d (diff) | |
| download | PROJ-c99cfa8ee743251faba9bc04ee5cf5a6010359eb.tar.gz PROJ-c99cfa8ee743251faba9bc04ee5cf5a6010359eb.zip | |
WKT parser: do not raise warning when parsing a WKT2:2015 TIMECRS whose TIMEUNIT is at the CS level, and not inside (#2276)
Adresses testTemporal() and testCompoundWithTime() cases of
https://github.com/OSGeo/PROJ/issues/2275#issuecomment-650765730
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/test_io.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index ddef0833..6c92b57d 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -4013,7 +4013,7 @@ TEST(wkt_parse, TemporalDatum_no_calendar) { // --------------------------------------------------------------------------- -TEST(wkt_parse, dateTimeTemporalCRS_WKT2) { +TEST(wkt_parse, dateTimeTemporalCRS_WKT2_2015) { auto wkt = "TIMECRS[\"Temporal CRS\",\n" " TDATUM[\"Gregorian calendar\",\n" " TIMEORIGIN[0000-01-01]],\n" @@ -4121,6 +4121,34 @@ TEST(wkt_parse, temporalCountCRSWithoutConvFactor_WKT2_2019) { // --------------------------------------------------------------------------- +TEST(wkt_parse, temporalMeasureCRS_WKT2_2015) { + auto wkt = "TIMECRS[\"GPS Time\",\n" + " TDATUM[\"Time origin\",\n" + " TIMEORIGIN[1980-01-01T00:00:00.0Z]],\n" + " CS[temporal,1],\n" + " AXIS[\"time\",future],\n" + " TIMEUNIT[\"day\",86400.0]]"; + + auto obj = WKTParser().createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast<TemporalCRS>(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_EQ(crs->nameStr(), "GPS Time"); + auto tdatum = crs->datum(); + EXPECT_EQ(tdatum->nameStr(), "Time origin"); + EXPECT_EQ(tdatum->temporalOrigin().toString(), "1980-01-01T00:00:00.0Z"); + EXPECT_TRUE(nn_dynamic_pointer_cast<TemporalMeasureCS>( + crs->coordinateSystem()) != nullptr); + auto cs = crs->coordinateSystem(); + ASSERT_EQ(cs->axisList().size(), 1U); + auto axis = cs->axisList()[0]; + EXPECT_EQ(axis->nameStr(), "Time"); + EXPECT_EQ(axis->unit().name(), "day"); + EXPECT_EQ(axis->unit().conversionToSI(), 86400.0); +} + +// --------------------------------------------------------------------------- + TEST(wkt_parse, temporalMeasureCRSWithoutConvFactor_WKT2_2019) { auto wkt = "TIMECRS[\"Decimal Years CE\",\n" " TIMEDATUM[\"Common Era\",\n" |
