diff options
| -rw-r--r-- | src/iso19111/crs.cpp | 12 | ||||
| -rw-r--r-- | test/unit/test_crs.cpp | 5 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index e4e05166..d0e23f95 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -4736,8 +4736,18 @@ void DerivedGeographicCRS::_exportToWKT(io::WKTFormatter *formatter) const { // --------------------------------------------------------------------------- void DerivedGeographicCRS::_exportToPROJString( - io::PROJStringFormatter *) const // throw(io::FormattingException) + io::PROJStringFormatter *formatter) const // throw(io::FormattingException) { + const auto &l_conv = derivingConversionRef(); + const auto &methodName = l_conv->method()->nameStr(); + if (methodName == "PROJ ob_tran o_proj=longlat" || + methodName == "PROJ ob_tran o_proj=lonlat" || + methodName == "PROJ ob_tran o_proj=latlong" || + methodName == "PROJ ob_tran o_proj=latlon") { + l_conv->_exportToPROJString(formatter); + return; + } + throw io::FormattingException( "DerivedGeographicCRS cannot be exported to PROJ string"); } diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 605df714..aee4dd73 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -4093,6 +4093,11 @@ TEST(crs, derivedGeographicCRS_to_PROJ) { auto obj = WKTParser().createFromWKT(wkt); auto crs = nn_dynamic_pointer_cast<DerivedGeographicCRS>(obj); ASSERT_TRUE(crs != nullptr); + EXPECT_EQ( + crs->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=ob_tran +o_proj=longlat +o_lat_p=52 +o_lon_p=-30 +lon_0=-25 " + "+datum=WGS84 +no_defs +type=crs"); + auto op = CoordinateOperationFactory::create()->createOperation( crs->baseCRS(), NN_NO_CHECK(crs)); ASSERT_TRUE(op != nullptr); |
