aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gie/builtins.gie204
-rw-r--r--test/unit/test_io.cpp68
2 files changed, 266 insertions, 6 deletions
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index f755526e..02e6766e 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -4266,11 +4266,11 @@ expect -223374.577355253 -111701.072127637
===============================================================================
# Orthographic
-# Azi, Sph.
+# Azi, Sph&Ell.
===============================================================================
-------------------------------------------------------------------------------
-# Test the equatorial aspect of the Orthopgraphic projection.
+# Test the equatorial aspect of the Orthographic projection.
# Test data from Snyder (1987), table 22, p. 151.
-------------------------------------------------------------------------------
@@ -4322,7 +4322,7 @@ expect failure errno tolerance_condition
-------------------------------------------------------------------------------
-# Test the oblique aspect of the Orthopgraphic projection.
+# Test the oblique aspect of the Orthographic projection.
# Test data from Snyder (1987), table 23, pp. 152-153.
-------------------------------------------------------------------------------
@@ -4356,7 +4356,7 @@ expect failure errno tolerance_condition
-------------------------------------------------------------------------------
-# Test the north polar aspect of the Orthopgraphic projection.
+# Test the north polar aspect of the Orthographic projection.
-------------------------------------------------------------------------------
operation +proj=ortho +R=1 +lat_0=90 +lon_0=0
-------------------------------------------------------------------------------
@@ -4386,7 +4386,7 @@ accept 2 2
expect failure errno tolerance_condition
-------------------------------------------------------------------------------
-# Test the south polar aspect of the Orthopgraphic projection.
+# Test the south polar aspect of the Orthographic projection.
-------------------------------------------------------------------------------
operation +proj=ortho +R=1 +lat_0=-90 +lon_0=0
-------------------------------------------------------------------------------
@@ -4421,6 +4421,200 @@ expect failure errno tolerance_condition
accept 0.70710678118 0.7071067812
expect 45 0
+
+-------------------------------------------------------------------------------
+# Test the ellipsoidal formulation
+
+# Test data from Guidance Note 7 part 2, March 2020, p. 90
+-------------------------------------------------------------------------------
+operation +proj=ortho +ellps=WGS84 +lat_0=55 +lon_0=5
+-------------------------------------------------------------------------------
+tolerance 1 mm
+accept 2.12955 53.80939444444444
+expect -189011.711 -128640.567
+roundtrip 1
+
+-------------------------------------------------------------------------------
+# Oblique
+-------------------------------------------------------------------------------
+operation +proj=ortho +ellps=WGS84 +lat_0=30
+
+# On boundary of visibility domain.
+direction forward
+tolerance 0.1 mm
+accept -90 0
+expect -6378137 18504.1253
+
+# This test is fragile. Note the slighly important tolerance
+# direction inverse
+# tolerance 100 mm
+# accept -6378137 18504.125313223721605027
+# expect -90 0
+
+# Slightly outside
+direction inverse
+accept -6378137.001 18504.1253
+expect failure errno tolerance_condition
+
+# On boundary of visibility domain
+direction forward
+tolerance 0.1 mm
+accept 0 -60
+expect 0 -6343601.0991
+
+# Just on it, but fails to converge. This test might be fragile
+direction inverse
+accept 0 -6343601.099075031466782093
+expect failure errno non_convergent
+
+# Slightly inside
+direction inverse
+tolerance 0.1 mm
+accept 0 -6343600
+expect 0 -59.966377950099655436
+
+
+-------------------------------------------------------------------------------
+# Equatorial
+-------------------------------------------------------------------------------
+operation +proj=ortho +ellps=WGS84
+tolerance 0.1 mm
+accept 0 0
+expect 0 0
+roundtrip 1
+
+accept 1 1
+expect 111296.9991 110568.7748
+roundtrip 1
+
+accept 1 -1
+expect 111296.9991 -110568.7748
+roundtrip 1
+
+accept -1 1
+expect -111296.9991 110568.7748
+roundtrip 1
+
+accept -1 -1
+expect -111296.9991 -110568.7748
+roundtrip 1
+
+accept 89.99 0
+expect 6378136.9029 0
+roundtrip 1
+
+accept -89.99 0
+expect -6378136.9029 0
+roundtrip 1
+
+accept 0 89.99
+expect 0 6356752.2167
+roundtrip 1
+
+accept 0 -89.99
+expect 0 -6356752.2167
+roundtrip 1
+
+# Point not visible from the projection plane
+accept 90.00001 0
+expect failure errno tolerance_condition
+
+# Point not visible from the projection plane
+accept -90.00001 0
+expect failure errno tolerance_condition
+
+# Consistant with WGS84 semi-major axis
+accept 90 0
+expect 6378137 0
+roundtrip 1
+
+accept -90 0
+expect -6378137 0
+roundtrip 1
+
+# Consistant with WGS84 semi-minor axis
+accept 0 90
+expect 0 6356752.3142
+roundtrip 1
+
+accept 0 -90
+expect 0 -6356752.3142
+roundtrip 1
+
+# Point not visible from the projection plane
+direction inverse
+accept 0 6356752.3143
+expect failure errno tolerance_condition
+
+# Point not visible from the projection plane
+direction inverse
+accept 1000 6356752.314
+expect failure errno tolerance_condition
+
+# Point not visible from the projection plane
+direction inverse
+accept 6378137.0001 0
+expect failure errno tolerance_condition
+
+-------------------------------------------------------------------------------
+# North pole tests
+-------------------------------------------------------------------------------
+operation +proj=ortho +ellps=WGS84 +lat_0=90
+tolerance 0.1 mm
+accept 0 90
+expect 0 0
+roundtrip 1
+
+accept 30 45
+expect 2258795.4394 -3912348.4650
+roundtrip 1
+
+accept 135 89.999999873385
+expect 0.01 0.01
+roundtrip 1
+
+# Point not visible from the projection plane
+accept 0 -0.0000001
+expect failure errno tolerance_condition
+
+# Consistant with WGS84 semi-major axis
+accept 0 0
+expect 0 -6378137
+roundtrip 1
+
+# Point not visible from the projection plane
+direction inverse
+accept 0 -6378137.1
+expect failure errno tolerance_condition
+
+-------------------------------------------------------------------------------
+# South pole tests
+-------------------------------------------------------------------------------
+operation +proj=ortho +ellps=WGS84 +lat_0=-90
+tolerance 0.1 mm
+accept 0 -90
+expect 0 0
+roundtrip 1
+
+accept 135 -89.999999873385
+expect 0.01 -0.01
+roundtrip 1
+
+# Point not visible from the projection plane
+accept 0 0.0000001
+expect failure errno tolerance_condition
+
+# Consistant with WGS84 semi-major axis
+accept 0 0
+expect 0 6378137
+roundtrip 1
+
+# Point not visible from the projection plane
+direction inverse
+accept 0 6378137.1
+expect failure errno tolerance_condition
+
+
===============================================================================
# Perspective Conic
# Conic, Sph
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index f2464e5c..34396fcf 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -5225,6 +5225,21 @@ static const struct {
{"False_Northing", 2},
{"Longitude_Of_Center", 3},
{"Latitude_Of_Center", 4}},
+ "Orthographic (Spherical)",
+ {
+ {"Latitude of natural origin", 4},
+ {"Longitude of natural origin", 3},
+ {"False easting", 1},
+ {"False northing", 2},
+ }},
+
+ {"Local",
+ {{"False_Easting", 1},
+ {"False_Northing", 2},
+ {"Scale_Factor", 1},
+ {"Azimuth", 0},
+ {"Longitude_Of_Center", 3},
+ {"Latitude_Of_Center", 4}},
"Orthographic",
{
{"Latitude of natural origin", 4},
@@ -5233,6 +5248,24 @@ static const struct {
{"False northing", 2},
}},
+ // Local with unsupported value for Azimuth
+ {"Local",
+ {{"False_Easting", 1},
+ {"False_Northing", 2},
+ {"Scale_Factor", 1},
+ {"Azimuth", 123},
+ {"Longitude_Of_Center", 3},
+ {"Latitude_Of_Center", 4}},
+ "Local",
+ {
+ {"False_Easting", 1},
+ {"False_Northing", 2},
+ {"Scale_Factor", 1},
+ {"Azimuth", 123},
+ {"Longitude_Of_Center", 3},
+ {"Latitude_Of_Center", 4},
+ }},
+
{"Winkel_Tripel",
{{"False_Easting", 1},
{"False_Northing", 2},
@@ -5543,7 +5576,6 @@ static const struct {
{"Longitude_Of_Origin", 3},
{"Latitude_Of_Origin", 4}},
},
-
};
TEST(wkt_parse, esri_projcs) {
@@ -9201,6 +9233,40 @@ TEST(io, projparse_non_earth_ellipsoid) {
// ---------------------------------------------------------------------------
+TEST(io, projparse_ortho_ellipsoidal) {
+ std::string input("+proj=ortho +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 "
+ "+ellps=WGS84 +units=m +no_defs +type=crs");
+ auto obj = PROJStringParser().createFromPROJString(input);
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->derivingConversion()->method()->getEPSGCode(),
+ EPSG_CODE_METHOD_ORTHOGRAPHIC);
+ EXPECT_EQ(
+ crs->exportToPROJString(
+ PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4)
+ .get()),
+ input);
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(io, projparse_ortho_spherical) {
+ std::string input("+proj=ortho +f=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 "
+ "+ellps=WGS84 +units=m +no_defs +type=crs");
+ auto obj = PROJStringParser().createFromPROJString(input);
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->derivingConversion()->method()->nameStr(),
+ PROJ_WKT2_NAME_ORTHOGRAPHIC_SPHERICAL);
+ EXPECT_EQ(
+ crs->exportToPROJString(
+ PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4)
+ .get()),
+ input);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(io, projparse_axisswap_unitconvert_longlat_proj) {
std::string input =
"+type=crs +proj=pipeline +step +proj=axisswap +order=2,1 +step "