aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_io.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-25 16:31:00 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-02-06 13:45:17 +0100
commitd7cd77244e1565fdc232b3d85a3b99720ecb42b4 (patch)
tree80256ae709285e0f5b95f3681c4f71373f0d31a1 /test/unit/test_io.cpp
parent4d0b2e91c52e4ddae04741931dead86cc52492f5 (diff)
downloadPROJ-d7cd77244e1565fdc232b3d85a3b99720ecb42b4.tar.gz
PROJ-d7cd77244e1565fdc232b3d85a3b99720ecb42b4.zip
Fix ingestion of +proj=cea with +k_0
Fixes #1881 Digging into the implementation of proj=cea, it appears that k_0 and lat_ts are intended to be exclusive ways of specifying the same concept. EPSG only models the variant using lat_s. So if k_0 is found and lat_ts is absent, compute the equivalent value of lat_ts from k_0. Note: k_0 should normally be in the [0,1] range. In case creative users would use something outside, we raise an exception, even if the cea implementation could potentially deal with any k_0 value. Hopefully this is a (reasonable) limitation that will address nominal use cases.
Diffstat (limited to 'test/unit/test_io.cpp')
-rw-r--r--test/unit/test_io.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index d165157d..399cea8c 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -7972,6 +7972,24 @@ TEST(io, projparse_cea_ellipsoidal) {
// ---------------------------------------------------------------------------
+TEST(io, projparse_cea_ellipsoidal_with_k_0) {
+ auto obj = PROJStringParser().createFromPROJString(
+ "+proj=cea +ellps=GRS80 +k_0=0.99 +type=crs");
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ WKTFormatterNNPtr f(WKTFormatter::create());
+ f->simulCurNodeHasId();
+ f->setMultiLine(false);
+ crs->exportToWKT(f.get());
+ auto wkt = f->toString();
+ EXPECT_TRUE(
+ wkt.find("PARAMETER[\"Latitude of 1st standard parallel\",8.1365") !=
+ std::string::npos)
+ << wkt;
+}
+
+// ---------------------------------------------------------------------------
+
TEST(io, projparse_geos_sweep_x) {
auto obj = PROJStringParser().createFromPROJString(
"+proj=geos +sweep=x +h=1 +type=crs");