diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-04-19 13:27:25 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-04-19 13:27:43 +0200 |
| commit | 605c01d2550e741b810989025079940778b75e29 (patch) | |
| tree | 4384aac1037a4b75d390daa3e12b35c49d98f137 /test/unit/test_io.cpp | |
| parent | b7f5e7ea751588914eec2b64fd2ee39ac2eefc54 (diff) | |
| download | PROJ-605c01d2550e741b810989025079940778b75e29.tar.gz PROJ-605c01d2550e741b810989025079940778b75e29.zip | |
Ingestion of WKT1_GDAL: correctly map 'Cylindrical_Equal_Area'
Map it to 'Lambert Cylindrical Equal Area' / EPSG:9835 non-spherical
method, when the ellipsoid is not a sphere. And rationalize the
handling of this for other methods with spherical vs non-spherical formulations
Diffstat (limited to 'test/unit/test_io.cpp')
| -rw-r--r-- | test/unit/test_io.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index c95b1b57..a227ff31 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -4475,7 +4475,7 @@ static const struct { {"Behrmann", {{"False_Easting", 1}, {"False_Northing", 2}, {"Central_Meridian", 3}}, - "Lambert Cylindrical Equal Area (Spherical)", + "Lambert Cylindrical Equal Area", { {"Latitude of 1st standard parallel", 30}, {"Longitude of natural origin", 3}, @@ -4776,7 +4776,7 @@ static const struct { {"False_Northing", 2}, {"Central_Meridian", 3}, {"Standard_Parallel_1", 4}}, - "Lambert Cylindrical Equal Area (Spherical)", + "Lambert Cylindrical Equal Area", { {"Latitude of 1st standard parallel", 4}, {"Longitude of natural origin", 3}, @@ -8128,6 +8128,30 @@ TEST(io, projparse_aeqd_guam) { // --------------------------------------------------------------------------- +TEST(io, projparse_cea_spherical) { + auto obj = PROJStringParser().createFromPROJString( + "+proj=cea +R=6371228 +type=crs"); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + EXPECT_EQ(crs->derivingConversion()->method()->getEPSGCode(), + EPSG_CODE_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA_SPHERICAL); + + auto crs2 = ProjectedCRS::create( + PropertyMap(), crs->baseCRS(), + Conversion::createLambertCylindricalEqualArea( + PropertyMap(), Angle(0), Angle(0), Length(0), Length(0)), + crs->coordinateSystem()); + EXPECT_EQ(crs2->derivingConversion()->method()->getEPSGCode(), + EPSG_CODE_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA); + + EXPECT_TRUE( + crs->isEquivalentTo(crs2.get(), IComparable::Criterion::EQUIVALENT)); + EXPECT_TRUE( + crs2->isEquivalentTo(crs.get(), IComparable::Criterion::EQUIVALENT)); +} + +// --------------------------------------------------------------------------- + TEST(io, projparse_cea_ellipsoidal) { auto obj = PROJStringParser().createFromPROJString( "+proj=cea +ellps=GRS80 +type=crs"); @@ -8651,6 +8675,17 @@ TEST(io, projparse_laea_spherical) { // --------------------------------------------------------------------------- +TEST(io, projparse_laea_ellipsoidal) { + auto obj = PROJStringParser().createFromPROJString( + "+proj=laea +ellps=WGS84 +type=crs"); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + EXPECT_EQ(crs->derivingConversion()->method()->getEPSGCode(), + EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA); +} + +// --------------------------------------------------------------------------- + TEST(io, projparse_eqc_spherical) { auto obj = PROJStringParser().createFromPROJString( "+proj=eqc +R=6371228 +type=crs"); @@ -8675,6 +8710,17 @@ TEST(io, projparse_eqc_spherical) { // --------------------------------------------------------------------------- +TEST(io, projparse_eqc_ellipsoidal) { + auto obj = PROJStringParser().createFromPROJString( + "+proj=eqc +ellps=WGS84 +type=crs"); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + EXPECT_EQ(crs->derivingConversion()->method()->getEPSGCode(), + EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL); +} + +// --------------------------------------------------------------------------- + TEST(io, projparse_non_earth_ellipsoid) { std::string input("+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +R=1 +units=m " "+no_defs +type=crs"); |
