diff options
| author | snowman2 <alansnow21@gmail.com> | 2020-01-01 20:29:16 -0600 |
|---|---|---|
| committer | snowman2 <alansnow21@gmail.com> | 2020-01-01 22:46:48 -0600 |
| commit | ea311993551f0019f38de361a5bc47fc630ee871 (patch) | |
| tree | 24b8f80e009cbcf67df64eb6457bc7ef12361ed2 /test | |
| parent | 2fd6f7fc0b2db4f5f7d54271e48577f3db7564bf (diff) | |
| download | PROJ-ea311993551f0019f38de361a5bc47fc630ee871.tar.gz PROJ-ea311993551f0019f38de361a5bc47fc630ee871.zip | |
fix exporting CoordinateSystem to PROJ JSON with ID
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/test_io.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 15ab8706..f7c73beb 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -11901,3 +11901,41 @@ TEST(json_import, multiple_ids) { EXPECT_EQ(ellps->exportToJSON(&(JSONFormatter::create()->setSchema("foo"))), json); } + +// --------------------------------------------------------------------------- + +TEST(json_export, coordinate_system_id) { + auto json = "{\n" + " \"$schema\": \"foo\",\n" + " \"type\": \"CoordinateSystem\",\n" + " \"subtype\": \"ellipsoidal\",\n" + " \"axis\": [\n" + " {\n" + " \"name\": \"Geodetic latitude\",\n" + " \"abbreviation\": \"Lat\",\n" + " \"direction\": \"north\",\n" + " \"unit\": \"degree\"\n" + " },\n" + " {\n" + " \"name\": \"Geodetic longitude\",\n" + " \"abbreviation\": \"Lon\",\n" + " \"direction\": \"east\",\n" + " \"unit\": \"degree\"\n" + " }\n" + " ],\n" + " \"id\": {\n" + " \"authority\": \"EPSG\",\n" + " \"code\": 6422\n" + " }\n" + "}"; + + auto dbContext = DatabaseContext::create(); + auto obj = createFromUserInput("EPSG:4326", dbContext); + auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj); + ASSERT_TRUE(crs != nullptr); + auto cs = crs->coordinateSystem(); + ASSERT_TRUE(cs != nullptr); + EXPECT_EQ( + cs->exportToJSON(&(JSONFormatter::create()->setSchema("foo"))), + json); +} |
