diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-11-21 23:59:33 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-11-21 23:59:33 +0100 |
| commit | 650e37f159b96d18f5ff03784466784a769688e4 (patch) | |
| tree | 830264fc953ccbca002eada48d50710499cac2c1 /test/unit/test_io.cpp | |
| parent | eb66679cde834096ff18f40b5b1d4bc10e3f4c1d (diff) | |
| download | PROJ-650e37f159b96d18f5ff03784466784a769688e4.tar.gz PROJ-650e37f159b96d18f5ff03784466784a769688e4.zip | |
PROJJSON parsing: fix parsing of a Geodetic CRS with a DatumEnsemble, and fix parsing of a ProjectedCRS whose base is a Geocentric CRS
Diffstat (limited to 'test/unit/test_io.cpp')
| -rw-r--r-- | test/unit/test_io.cpp | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 558b2a6f..81894fb0 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -11206,6 +11206,155 @@ TEST(json_import, projected_crs) { // --------------------------------------------------------------------------- +TEST(json_import, projected_crs_with_geocentric_base) { + auto json = "{\n" + " \"$schema\": \"foo\",\n" + " \"type\": \"ProjectedCRS\",\n" + " \"name\": \"EPSG topocentric example B\",\n" + " \"base_crs\": {\n" + " \"name\": \"WGS 84\",\n" + " \"datum_ensemble\": {\n" + " \"name\": \"World Geodetic System 1984 ensemble\",\n" + " \"members\": [\n" + " {\n" + " \"name\": \"World Geodetic System 1984 (Transit)\"\n" + " },\n" + " {\n" + " \"name\": \"World Geodetic System 1984 (G730)\"\n" + " },\n" + " {\n" + " \"name\": \"World Geodetic System 1984 (G873)\"\n" + " },\n" + " {\n" + " \"name\": \"World Geodetic System 1984 (G1150)\"\n" + " },\n" + " {\n" + " \"name\": \"World Geodetic System 1984 (G1674)\"\n" + " },\n" + " {\n" + " \"name\": \"World Geodetic System 1984 (G1762)\"\n" + " }\n" + " ],\n" + " \"ellipsoid\": {\n" + " \"name\": \"WGS 84\",\n" + " \"semi_major_axis\": 6378137,\n" + " \"inverse_flattening\": 298.257223563\n" + " },\n" + " \"accuracy\": \"2.0\"\n" + " },\n" + " \"coordinate_system\": {\n" + " \"subtype\": \"Cartesian\",\n" + " \"axis\": [\n" + " {\n" + " \"name\": \"Geocentric X\",\n" + " \"abbreviation\": \"X\",\n" + " \"direction\": \"geocentricX\",\n" + " \"unit\": \"metre\"\n" + " },\n" + " {\n" + " \"name\": \"Geocentric Y\",\n" + " \"abbreviation\": \"Y\",\n" + " \"direction\": \"geocentricY\",\n" + " \"unit\": \"metre\"\n" + " },\n" + " {\n" + " \"name\": \"Geocentric Z\",\n" + " \"abbreviation\": \"Z\",\n" + " \"direction\": \"geocentricZ\",\n" + " \"unit\": \"metre\"\n" + " }\n" + " ]\n" + " },\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 4978\n" + " }\n" + " },\n" + " \"conversion\": {\n" + " \"name\": \"EPSG topocentric example B\",\n" + " \"method\": {\n" + " \"name\": \"Geocentric/topocentric conversions\",\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 9836\n" + " }\n" + " },\n" + " \"parameters\": [\n" + " {\n" + " \"name\": \"Geocentric X of topocentric origin\",\n" + " \"value\": 3771793.97,\n" + " \"unit\": \"metre\",\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 8837\n" + " }\n" + " },\n" + " {\n" + " \"name\": \"Geocentric Y of topocentric origin\",\n" + " \"value\": 140253.34,\n" + " \"unit\": \"metre\",\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 8838\n" + " }\n" + " },\n" + " {\n" + " \"name\": \"Geocentric Z of topocentric origin\",\n" + " \"value\": 5124304.35,\n" + " \"unit\": \"metre\",\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 8839\n" + " }\n" + " }\n" + " ]\n" + " },\n" + " \"coordinate_system\": {\n" + " \"subtype\": \"Cartesian\",\n" + " \"axis\": [\n" + " {\n" + " \"name\": \"Topocentric East\",\n" + " \"abbreviation\": \"U\",\n" + " \"direction\": \"east\",\n" + " \"unit\": \"metre\"\n" + " },\n" + " {\n" + " \"name\": \"Topocentric North\",\n" + " \"abbreviation\": \"V\",\n" + " \"direction\": \"north\",\n" + " \"unit\": \"metre\"\n" + " },\n" + " {\n" + " \"name\": \"Topocentric height\",\n" + " \"abbreviation\": \"W\",\n" + " \"direction\": \"up\",\n" + " \"unit\": \"metre\"\n" + " }\n" + " ]\n" + " },\n" + " \"scope\": \"Example only (fictitious).\",\n" + " \"area\": \"Description of the extent of the CRS.\",\n" + " \"bbox\": {\n" + " \"south_latitude\": -90,\n" + " \"west_longitude\": -180,\n" + " \"north_latitude\": 90,\n" + " \"east_longitude\": 180\n" + " },\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 5820\n" + " }\n" + "}"; + auto obj = createFromUserInput(json, nullptr); + auto pcrs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(pcrs != nullptr); + EXPECT_TRUE(pcrs->baseCRS()->isGeocentric()); + EXPECT_EQ(pcrs->exportToJSON(&(JSONFormatter::create()->setSchema("foo"))), + json); +} + +// --------------------------------------------------------------------------- + TEST(json_import, compound_crs) { auto json = "{\n" " \"$schema\": \"foo\",\n" |
