From 3f9c0a0b73d6567b3f05a89e337e5ff9f9d5904a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 27 Aug 2021 18:33:26 +0200 Subject: ESRI WKT: add support for import/export of (non interrupted) Goode Homolosine Issue found during https://github.com/OSGeo/gdal/pull/4355 when it was found that a WKT with Goode_Homolosine projection parsed as ESRI WKT was mapped wrongly to Interrupted Goode Homolosine --- test/unit/test_io.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test') diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index a899482e..72ac1868 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -5718,6 +5718,18 @@ static const struct { {"Northing at projection centre", 2}, }}, + {"Goode_Homolosine", + {{"False_Easting", 1}, + {"False_Northing", 2}, + {"Central_Meridian", 3}, + {"Option", 0.0}}, + "Goode Homolosine", + { + {"Longitude of natural origin", 3}, + {"False easting", 1}, + {"False northing", 2}, + }}, + {"Goode_Homolosine", {{"False_Easting", 1}, {"False_Northing", 2}, @@ -6290,6 +6302,31 @@ TEST(wkt_parse, wkt1_esri_gauss_kruger) { // --------------------------------------------------------------------------- +TEST(wkt_parse, wkt1_esri_goode_homolosine_without_option_0) { + // Not sure if it is really valid to not have PARAMETER["Option",0.0] + // but it seems reasonable to check that we understand that as + // Goode Homolosine and not Interrupted Goode Homolosine (option 1) + auto wkt = "PROJCS[\"unknown\",GEOGCS[\"GCS_unknown\",DATUM[\"D_WGS_1984\"," + "SPHEROID[\"WGS_1984\",6378137.0,298.257223563]]," + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Goode_Homolosine\"]," + "PARAMETER[\"False_Easting\",0.0]," + "PARAMETER[\"False_Northing\",0.0]," + "PARAMETER[\"Central_Meridian\",0.0]," + "UNIT[\"Meter\",1.0]]"; + + auto obj = WKTParser() + .attachDatabaseContext(DatabaseContext::create()) + .createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_EQ(crs->derivingConversion()->method()->nameStr(), + "Goode Homolosine"); +} + +// --------------------------------------------------------------------------- + TEST(wkt_parse, wkt1_oracle) { // WKT from mdsys.cs_srs Oracle table auto wkt = "PROJCS[\"RGF93 / Lambert-93\", GEOGCS [ \"RGF93\", " -- cgit v1.2.3