aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_datum.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-08-20 13:22:01 +0200
committerGitHub <noreply@github.com>2019-08-20 13:22:01 +0200
commit2c9c015a6529548f5a5d448c78bc9b565d751590 (patch)
tree2597c59e8270f1480785c97f7441ee0b295c29b3 /test/unit/test_datum.cpp
parente52fc2aa58504e6f0658da821bdd543d7a39df34 (diff)
parentcad1c5cf61fc00759bf4ad17b0b34f57f4945de6 (diff)
downloadPROJ-2c9c015a6529548f5a5d448c78bc9b565d751590.tar.gz
PROJ-2c9c015a6529548f5a5d448c78bc9b565d751590.zip
Merge pull request #1547 from rouault/json_export
Add CRS JSON export (refs #1545)
Diffstat (limited to 'test/unit/test_datum.cpp')
-rw-r--r--test/unit/test_datum.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/test_datum.cpp b/test/unit/test_datum.cpp
index fa53ff85..fbd1f79d 100644
--- a/test/unit/test_datum.cpp
+++ b/test/unit/test_datum.cpp
@@ -205,6 +205,42 @@ TEST(datum, prime_meridian_to_PROJString) {
// ---------------------------------------------------------------------------
+TEST(datum, prime_meridian_to_JSON) {
+
+ EXPECT_EQ(PrimeMeridian::GREENWICH->exportToJSON(
+ &(JSONFormatter::create()->setSchema(""))),
+ "{\n"
+ " \"type\": \"PrimeMeridian\",\n"
+ " \"name\": \"Greenwich\",\n"
+ " \"longitude\": 0,\n"
+ " \"id\": {\n"
+ " \"authority\": \"EPSG\",\n"
+ " \"code\": 8901\n"
+ " }\n"
+ "}");
+
+ EXPECT_EQ(PrimeMeridian::PARIS->exportToJSON(
+ &(JSONFormatter::create()->setSchema(""))),
+ "{\n"
+ " \"type\": \"PrimeMeridian\",\n"
+ " \"name\": \"Paris\",\n"
+ " \"longitude\": {\n"
+ " \"value\": 2.5969213,\n"
+ " \"unit\": {\n"
+ " \"type\": \"AngularUnit\",\n"
+ " \"name\": \"grad\",\n"
+ " \"conversion_factor\": 0.015707963267949\n"
+ " }\n"
+ " },\n"
+ " \"id\": {\n"
+ " \"authority\": \"EPSG\",\n"
+ " \"code\": 8903\n"
+ " }\n"
+ "}");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(datum, datum_with_ANCHOR) {
auto datum = GeodeticReferenceFrame::create(
PropertyMap().set(IdentifiedObject::NAME_KEY, "WGS_1984 with anchor"),