aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_io.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2019-03-26 12:07:27 +0100
committerGitHub <noreply@github.com>2019-03-26 12:07:27 +0100
commitd21fb4e9abd3246fcbece6724dd3d014c35df25e (patch)
treeee4ba388d7d9507397b5cbad5814cb7e1ee540c0 /test/unit/test_io.cpp
parent66774791d16d1b197911e595aaaceb9690c8ca14 (diff)
parent09db4826d4a1e5df900cb4b93a4b3eae2c487cb9 (diff)
downloadPROJ-d21fb4e9abd3246fcbece6724dd3d014c35df25e.tar.gz
PROJ-d21fb4e9abd3246fcbece6724dd3d014c35df25e.zip
Merge pull request #1366 from rouault/ogc_18_010r6_further_fixes
OGC 18-010r6 further fixes regarding WKT2:2018 export
Diffstat (limited to 'test/unit/test_io.cpp')
-rw-r--r--test/unit/test_io.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 1d097d9b..17b3c334 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -1663,6 +1663,50 @@ TEST(wkt_parse, wkt2_2018_projected_with_id_in_basegeodcrs) {
ASSERT_TRUE(crs != nullptr);
ASSERT_EQ(crs->baseCRS()->identifiers().size(), 1U);
EXPECT_EQ(crs->baseCRS()->identifiers().front()->code(), "4326");
+
+ {
+ auto got_wkt = crs->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT2_2018).get());
+ EXPECT_TRUE(got_wkt.find("ID[\"EPSG\",4326]]") != std::string::npos)
+ << got_wkt;
+ }
+
+ {
+ auto got_wkt = crs->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT2_2018_SIMPLIFIED)
+ .get());
+ EXPECT_TRUE(got_wkt.find("ID[\"EPSG\",4326]]") == std::string::npos)
+ << got_wkt;
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(wkt_parse, wkt2_2018_projected_no_id_but_id_in_basegeodcrs) {
+ auto wkt = "PROJCRS[\"WGS 84 / UTM zone 31N\",\n"
+ " BASEGEOGCRS[\"WGS 84\",\n"
+ " DATUM[\"World Geodetic System 1984\",\n"
+ " ELLIPSOID[\"WGS 84\",6378137,298.257223563]],\n"
+ " ID[\"EPSG\",4326]],\n"
+ " CONVERSION[\"UTM zone 31N\",\n"
+ " METHOD[\"Transverse Mercator\"],\n"
+ " PARAMETER[\"Latitude of natural origin\",0],\n"
+ " PARAMETER[\"Longitude of natural origin\",3],\n"
+ " PARAMETER[\"Scale factor at natural origin\",0.9996],\n"
+ " PARAMETER[\"False easting\",500000],\n"
+ " PARAMETER[\"False northing\",0]],\n"
+ " CS[Cartesian,2],\n"
+ " AXIS[\"(E)\",east],\n"
+ " AXIS[\"(N)\",north],\n"
+ " UNIT[\"metre\",1]]";
+ auto obj = WKTParser().createFromWKT(wkt);
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+
+ auto got_wkt = crs->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT2_2018).get());
+ EXPECT_TRUE(got_wkt.find("ID[\"EPSG\",4326]]") != std::string::npos)
+ << got_wkt;
}
// ---------------------------------------------------------------------------