diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/cli/testprojinfo_out.dist | 2 | ||||
| -rw-r--r-- | test/unit/test_c_api.cpp | 2 | ||||
| -rw-r--r-- | test/unit/test_io.cpp | 56 |
3 files changed, 52 insertions, 8 deletions
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index c1d9f3e0..40b8330a 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -137,7 +137,7 @@ GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.25722 PROJJSON: { - "$schema": "https://proj.org/schemas/v0.1/projjson.schema.json", + "$schema": "https://proj.org/schemas/v0.2/projjson.schema.json", "type": "GeographicCRS", "name": "WGS 84", "datum": { diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 8ac5a511..5e6d1924 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3600,7 +3600,7 @@ TEST_F(CApi, proj_as_projjson) { EXPECT_EQ(std::string(projjson), "{\n" " \"$schema\": " - "\"https://proj.org/schemas/v0.1/projjson.schema.json\",\n" + "\"https://proj.org/schemas/v0.2/projjson.schema.json\",\n" " \"type\": \"Ellipsoid\",\n" " \"name\": \"WGS 84\",\n" " \"semi_major_axis\": 6378137,\n" diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 074a59b9..6bb93e97 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -1960,16 +1960,21 @@ TEST(wkt_parse, vertcrs_VRF_WKT2) { // --------------------------------------------------------------------------- TEST(wkt_parse, vertcrs_with_GEOIDMODEL) { - auto wkt = "VERTCRS[\"CGVD2013\"," - " VRF[\"Canadian Geodetic Vertical Datum of 2013\"]," - " CS[vertical,1]," - " AXIS[\"gravity-related height (H)\",up]," - " LENGTHUNIT[\"metre\",1.0]," - " GEOIDMODEL[\"CGG2013\",ID[\"EPSG\",6648]]]"; + auto wkt = "VERTCRS[\"CGVD2013\",\n" + " VDATUM[\"Canadian Geodetic Vertical Datum of 2013\"],\n" + " CS[vertical,1],\n" + " AXIS[\"gravity-related height (H)\",up,\n" + " LENGTHUNIT[\"metre\",1]],\n" + " GEOIDMODEL[\"CGG2013\",\n" + " ID[\"EPSG\",6648]]]"; auto obj = WKTParser().createFromWKT(wkt); auto crs = nn_dynamic_pointer_cast<VerticalCRS>(obj); ASSERT_TRUE(crs != nullptr); + EXPECT_EQ( + crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT2_2019).get()), + wkt); } // --------------------------------------------------------------------------- @@ -10808,6 +10813,45 @@ TEST(json_import, vertical_crs_with_datum_ensemble) { // --------------------------------------------------------------------------- +TEST(json_import, vertical_crs_with_geoid_model) { + auto json = "{\n" + " \"$schema\": \"foo\",\n" + " \"type\": \"VerticalCRS\",\n" + " \"name\": \"CGVD2013\",\n" + " \"datum\": {\n" + " \"type\": \"VerticalReferenceFrame\",\n" + " \"name\": \"Canadian Geodetic Vertical Datum of 2013\"\n" + " },\n" + " \"coordinate_system\": {\n" + " \"subtype\": \"vertical\",\n" + " \"axis\": [\n" + " {\n" + " \"name\": \"Gravity-related height\",\n" + " \"abbreviation\": \"H\",\n" + " \"direction\": \"up\",\n" + " \"unit\": \"metre\"\n" + " }\n" + " ]\n" + " },\n" + " \"geoid_model\": {\n" + " \"name\": \"CGG2013\",\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 6648\n" + " }\n" + " }\n" + "}"; + + // No database + auto obj = createFromUserInput(json, nullptr); + auto vcrs = nn_dynamic_pointer_cast<VerticalCRS>(obj); + ASSERT_TRUE(vcrs != nullptr); + EXPECT_EQ(vcrs->exportToJSON(&(JSONFormatter::create()->setSchema("foo"))), + json); +} + +// --------------------------------------------------------------------------- + TEST(json_import, parametric_crs) { auto json = "{\n" " \"$schema\": \"foo\",\n" |
