diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2022-03-10 10:48:39 +0100 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2022-03-10 09:49:04 +0000 |
| commit | efc958e953b8c4a7fe9eaa7015d94c8456968bd4 (patch) | |
| tree | 08aa90a6806d5719fca55925d10c873df2982979 | |
| parent | d54cc9e44759818f3356c35c7b59f3ffaf7213db (diff) | |
| download | PROJ-efc958e953b8c4a7fe9eaa7015d94c8456968bd4.tar.gz PROJ-efc958e953b8c4a7fe9eaa7015d94c8456968bd4.zip | |
Merge pull request #3108 from rouault/fix_3095
createOperations(): fix issue in transformation northing,easting projected CRS -> +proj=longlat +lon_wrap (fixes #3095)
| -rw-r--r-- | src/iso19111/crs.cpp | 3 | ||||
| -rw-r--r-- | test/unit/test_operationfactory.cpp | 26 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 881aec0b..e4b8094f 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -4404,7 +4404,8 @@ void ProjectedCRS::addUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter, formatter->addParam("units", "m"); } - if (!axisSpecFound && !formatter->getCRSExport()) { + if (!axisSpecFound && + (!formatter->getCRSExport() || formatter->getLegacyCRSToCRSContext())) { const auto &dir0 = axisList[0]->direction(); const auto &dir1 = axisList[1]->direction(); if (!(&dir0 == &cs::AxisDirection::EAST && diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp index 89c4e7c4..0c3ecae4 100644 --- a/test/unit/test_operationfactory.cpp +++ b/test/unit/test_operationfactory.cpp @@ -6569,6 +6569,32 @@ TEST(operation, createOperation_on_crs_with_bound_crs_and_wktext) { // --------------------------------------------------------------------------- +TEST(operation, + createOperation_fallback_to_proj4_strings_with_axis_inverted_projCRS) { + auto objSrc = + createFromUserInput("EPSG:2193", DatabaseContext::create(), false); + auto src = nn_dynamic_pointer_cast<CRS>(objSrc); + ASSERT_TRUE(src != nullptr); + + auto objDest = PROJStringParser().createFromPROJString( + "+proj=longlat +ellps=WGS84 +lon_wrap=180 +type=crs"); + auto dest = nn_dynamic_pointer_cast<GeographicCRS>(objDest); + ASSERT_TRUE(dest != nullptr); + + auto op = CoordinateOperationFactory::create()->createOperation( + NN_CHECK_ASSERT(src), NN_CHECK_ASSERT(dest)); + ASSERT_TRUE(op != nullptr); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline " + "+step +proj=axisswap +order=2,1 " + "+step +inv +proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 " + "+x_0=1600000 +y_0=10000000 +ellps=GRS80 " + "+step +proj=longlat +ellps=WGS84 +lon_wrap=180 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg"); +} + +// --------------------------------------------------------------------------- + TEST(operation, compoundCRS_to_proj_string_with_non_metre_height) { auto objSrc = createFromUserInput("EPSG:6318+5703", DatabaseContext::create(), false); |
