diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2022-01-11 11:28:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-11 11:28:16 +0100 |
| commit | 10fc60fdce62520230039345db0446738e77afca (patch) | |
| tree | 60847a7efd86daecaaa88bf630edaf8dfccb4a96 /test/unit/test_io.cpp | |
| parent | c6c2a3b22ddef30a29cfc48ca810ee1a54385242 (diff) | |
| parent | 7afaa7a400bd3e6a8550a5c6a3d0da88b3861e38 (diff) | |
| download | PROJ-10fc60fdce62520230039345db0446738e77afca.tar.gz PROJ-10fc60fdce62520230039345db0446738e77afca.zip | |
Merge pull request #3014 from rouault/fix_3011
peirce_q: rename +type parameter wrongly introduced in 8.2.1 to +shape (fixes #3011)
Diffstat (limited to 'test/unit/test_io.cpp')
| -rw-r--r-- | test/unit/test_io.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 5ffa461b..1c7fc812 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -6075,6 +6075,38 @@ static const struct { {"False northing", 2}, }}, + {"Peirce_Quincuncial", + {{"False_Easting", 1}, + {"False_Northing", 2}, + {"Central_Meridian", 3}, + {"Scale_Factor", 4}, + {"Latitude_Of_Origin", 5}, + {"Option", 0}}, + "Peirce Quincuncial (Square)", + { + {"Latitude of natural origin", 5}, + {"Longitude of natural origin", 3}, + {"Scale factor at natural origin", 4}, + {"False easting", 1}, + {"False northing", 2}, + }}, + + {"Peirce_Quincuncial", + {{"False_Easting", 1}, + {"False_Northing", 2}, + {"Central_Meridian", 3}, + {"Scale_Factor", 4}, + {"Latitude_Of_Origin", 5}, + {"Option", 1}}, + "Peirce Quincuncial (Diamond)", + { + {"Latitude of natural origin", 5}, + {"Longitude of natural origin", 3}, + {"Scale factor at natural origin", 4}, + {"False easting", 1}, + {"False northing", 2}, + }}, + { "Unknown_Method", {{"False_Easting", 1}, @@ -9931,6 +9963,49 @@ TEST(io, projparse_ortho_spherical_on_sphere) { // --------------------------------------------------------------------------- +TEST(io, projparse_peirce_q) { + std::string input("+proj=peirce_q +shape=square +type=crs"); + auto obj = PROJStringParser().createFromPROJString(input); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + EXPECT_EQ( + crs->exportToPROJString( + PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4) + .get()), + "+proj=peirce_q +shape=square +lat_0=90 +lon_0=0 +k_0=1 +x_0=0 +y_0=0 " + "+datum=WGS84 +units=m +no_defs +type=crs"); +} + +// --------------------------------------------------------------------------- + +TEST(io, projparse_peirce_q_invalid_lat_0) { + std::string input("+proj=peirce_q +lat_0=0 +shape=square +type=crs"); + auto obj = PROJStringParser().createFromPROJString(input); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + EXPECT_THROW( + crs->exportToPROJString( + PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4) + .get()), + FormattingException); +} + +// --------------------------------------------------------------------------- + +TEST(io, projparse_peirce_q_invalid_k_0) { + std::string input("+proj=peirce_q +k_0=0.5 +shape=square +type=crs"); + auto obj = PROJStringParser().createFromPROJString(input); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + EXPECT_THROW( + crs->exportToPROJString( + PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4) + .get()), + FormattingException); +} + +// --------------------------------------------------------------------------- + TEST(io, projparse_axisswap_unitconvert_longlat_proj) { std::string input = "+type=crs +proj=pipeline +step +proj=axisswap +order=2,1 +step " |
