diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-10-02 22:19:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-02 22:19:41 +0200 |
| commit | dca893f02ac822f2ccf5f02a4331920eeb42299a (patch) | |
| tree | 496cf41d98468db2a74673619c235b2f71830889 /test | |
| parent | 8040ef90f122f06254a36c36e20b97a5a7744a04 (diff) | |
| parent | f32255aa1139568df8cfb646ea62ca900939c105 (diff) | |
| download | PROJ-dca893f02ac822f2ccf5f02a4331920eeb42299a.tar.gz PROJ-dca893f02ac822f2ccf5f02a4331920eeb42299a.zip | |
Merge pull request #1650 from rouault/map_nsper_to_vertical_perspective
Add API and WKT mapping for 'nsper' to EPSG Vertical Perspective method
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/test_c_api.cpp | 7 | ||||
| -rw-r--r-- | test/unit/test_operation.cpp | 68 |
2 files changed, 75 insertions, 0 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 483ecdbd..b4c620ce 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -2402,6 +2402,13 @@ TEST_F(CApi, proj_create_projections) { ObjectKeeper keeper_projCRS(projCRS); ASSERT_NE(projCRS, nullptr); } + { + auto projCRS = proj_create_conversion_vertical_perspective( + m_ctxt, 0, 0, 0, 0, 0, 0, "Degree", 0.0174532925199433, "Metre", + 1.0); + ObjectKeeper keeper_projCRS(projCRS); + ASSERT_NE(projCRS, nullptr); + } /* END: Generated by scripts/create_c_api_projections.py*/ } diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index ddbb1cc9..fcbbb566 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -4091,6 +4091,74 @@ TEST(operation, eqearth_export) { // --------------------------------------------------------------------------- +TEST(operation, vertical_perspective_export) { + + auto conv = Conversion::createVerticalPerspective( + PropertyMap(), Angle(1), Angle(2), Length(3), Length(4), Length(5), + Length(6)); + + EXPECT_EQ(conv->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=nsper +lat_0=1 +lon_0=2 +h=4 +x_0=5 +y_0=6"); + + EXPECT_EQ(conv->exportToWKT(WKTFormatter::create().get()), + "CONVERSION[\"Vertical Perspective\",\n" + " METHOD[\"Vertical Perspective\",\n" + " ID[\"EPSG\",9838]],\n" + " PARAMETER[\"Latitude of topocentric origin\",1,\n" + " ANGLEUNIT[\"degree\",0.0174532925199433],\n" + " ID[\"EPSG\",8834]],\n" + " PARAMETER[\"Longitude of topocentric origin\",2,\n" + " ANGLEUNIT[\"degree\",0.0174532925199433],\n" + " ID[\"EPSG\",8835]],\n" + " PARAMETER[\"Ellipsoidal height of topocentric origin\",3,\n" + " LENGTHUNIT[\"metre\",1],\n" + " ID[\"EPSG\",8836]],\n" + " PARAMETER[\"Viewpoint height\",4,\n" + " LENGTHUNIT[\"metre\",1],\n" + " ID[\"EPSG\",8840]],\n" + " PARAMETER[\"False easting\",5,\n" + " LENGTHUNIT[\"metre\",1],\n" + " ID[\"EPSG\",8806]],\n" + " PARAMETER[\"False northing\",6,\n" + " LENGTHUNIT[\"metre\",1],\n" + " ID[\"EPSG\",8807]]]"); +} + +// --------------------------------------------------------------------------- + +TEST( + operation, + vertical_perspective_export_no_topocentric_height_and_false_easting_northing) { + + auto conv = Conversion::createVerticalPerspective( + PropertyMap(), Angle(1), Angle(2), Length(0), Length(4), Length(0), + Length(0)); + + EXPECT_EQ(conv->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=nsper +lat_0=1 +lon_0=2 +h=4 +x_0=0 +y_0=0"); + + // Check that False esting and False northing are not exported, when they + // are 0. + EXPECT_EQ(conv->exportToWKT(WKTFormatter::create().get()), + "CONVERSION[\"Vertical Perspective\",\n" + " METHOD[\"Vertical Perspective\",\n" + " ID[\"EPSG\",9838]],\n" + " PARAMETER[\"Latitude of topocentric origin\",1,\n" + " ANGLEUNIT[\"degree\",0.0174532925199433],\n" + " ID[\"EPSG\",8834]],\n" + " PARAMETER[\"Longitude of topocentric origin\",2,\n" + " ANGLEUNIT[\"degree\",0.0174532925199433],\n" + " ID[\"EPSG\",8835]],\n" + " PARAMETER[\"Ellipsoidal height of topocentric origin\",0,\n" + " LENGTHUNIT[\"metre\",1],\n" + " ID[\"EPSG\",8836]],\n" + " PARAMETER[\"Viewpoint height\",4,\n" + " LENGTHUNIT[\"metre\",1],\n" + " ID[\"EPSG\",8840]]]"); +} + +// --------------------------------------------------------------------------- + TEST(operation, laborde_oblique_mercator) { // Content of EPSG:29701 "Tananarive (Paris) / Laborde Grid" |
