aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-10-02 22:19:41 +0200
committerGitHub <noreply@github.com>2019-10-02 22:19:41 +0200
commitdca893f02ac822f2ccf5f02a4331920eeb42299a (patch)
tree496cf41d98468db2a74673619c235b2f71830889 /test/unit/test_operation.cpp
parent8040ef90f122f06254a36c36e20b97a5a7744a04 (diff)
parentf32255aa1139568df8cfb646ea62ca900939c105 (diff)
downloadPROJ-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/unit/test_operation.cpp')
-rw-r--r--test/unit/test_operation.cpp68
1 files changed, 68 insertions, 0 deletions
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"