aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/source/operations/operations_computation.rst11
-rw-r--r--src/iso19111/crs.cpp16
-rw-r--r--src/iso19111/io.cpp17
-rw-r--r--test/unit/test_operationfactory.cpp6
4 files changed, 29 insertions, 21 deletions
diff --git a/docs/source/operations/operations_computation.rst b/docs/source/operations/operations_computation.rst
index af177f6c..5c003ed2 100644
--- a/docs/source/operations/operations_computation.rst
+++ b/docs/source/operations/operations_computation.rst
@@ -5,7 +5,7 @@ Computation of coordinate operations between two CRS
================================================================================
:Author: Even Rouault
-:Last Updated: 2020-01-02
+:Last Updated: 2021-02-10
Introduction
------------
@@ -50,7 +50,7 @@ geographic CRS:
The algorithm involves many cases, so we will progress in the explanation from
the most simple case to more complex ones. We document here the working of this
-algorithm as implemented in PROJ 6.3.0.
+algorithm as implemented in PROJ 8.0.0.
The results of some examples might also be quite sensitive to the content of the
PROJ database and the PROJ version used.
@@ -149,11 +149,12 @@ performed in the order they are listed below:
10. in case of same accuracy, consider as more relevant an operation that does
not use grids (operations that use only parameters will be faster)
11. consider as more relevant an operation that involves less transformation steps
+ (transformation steps considered are the ones listed in the WKT output, not PROJ pipeline steps)
12. and for completeness, if two operations are comparable given all the above criteria,
consider as more relevant the one which has the shorter name, and if they
- have the same length, consider as more relevant the one whose name comes first in
- lexicographic order (obviously completely arbitrary, but a sorting
- algorithm must be able to compare all entries)
+ have the same length, consider as more relevant the one whose name comes last in
+ lexicographic order (e.g. "FOO to BAR (3)" will have higher precedence than
+ "FOO to BAR (2)")
Geodetic/geographic CRS to Geodetic/geographic CRS, without known identifiers
-----------------------------------------------------------------------------
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index 9d58f733..1ac60d88 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -5757,11 +5757,17 @@ void DerivedGeographicCRS::_exportToPROJString(
{
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" ||
- ci_equal(methodName,
+
+ for (const char *substr :
+ {"PROJ ob_tran o_proj=longlat", "PROJ ob_tran o_proj=lonlat",
+ "PROJ ob_tran o_proj=latlon", "PROJ ob_tran o_proj=latlong"}) {
+ if (starts_with(methodName, substr)) {
+ l_conv->_exportToPROJString(formatter);
+ return;
+ }
+ }
+
+ if (ci_equal(methodName,
PROJ_WKT2_NAME_METHOD_POLE_ROTATION_GRIB_CONVENTION)) {
l_conv->_exportToPROJString(formatter);
return;
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index c0844608..6ea6316c 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -9674,14 +9674,15 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS(
parameters, values)
.as_nullable();
- if (is_in_stringlist(methodName, "PROJ ob_tran o_proj=longlat,"
- "PROJ ob_tran o_proj=lonlat,"
- "PROJ ob_tran o_proj=latlon,"
- "PROJ ob_tran o_proj=latlong")) {
- return DerivedGeographicCRS::create(
- PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"),
- geogCRS, NN_NO_CHECK(conv),
- buildEllipsoidalCS(iStep, iUnitConvert, iAxisSwap, false));
+ for (const char *substr :
+ {"PROJ ob_tran o_proj=longlat", "PROJ ob_tran o_proj=lonlat",
+ "PROJ ob_tran o_proj=latlon", "PROJ ob_tran o_proj=latlong"}) {
+ if (starts_with(methodName, substr)) {
+ return DerivedGeographicCRS::create(
+ PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"),
+ geogCRS, NN_NO_CHECK(conv),
+ buildEllipsoidalCS(iStep, iUnitConvert, iAxisSwap, false));
+ }
}
}
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp
index 32c872ac..a64959a8 100644
--- a/test/unit/test_operationfactory.cpp
+++ b/test/unit/test_operationfactory.cpp
@@ -6336,7 +6336,7 @@ TEST(operation, createOperation_ossfuzz_18587) {
TEST(operation, derivedGeographicCRS_with_to_wgs84_to_geographicCRS) {
auto objSrc = PROJStringParser().createFromPROJString(
"+proj=ob_tran +o_proj=latlon +lat_0=0 +lon_0=180 +o_lat_p=18.0 "
- "+o_lon_p=-200.0 +ellps=WGS84 +towgs84=1,2,3 +type=crs");
+ "+o_lon_p=-200.0 +ellps=WGS84 +towgs84=1,2,3 +over +type=crs");
auto src = nn_dynamic_pointer_cast<CRS>(objSrc);
ASSERT_TRUE(src != nullptr);
auto objDst = PROJStringParser().createFromPROJString(
@@ -6351,7 +6351,7 @@ TEST(operation, derivedGeographicCRS_with_to_wgs84_to_geographicCRS) {
std::string pipeline(
"+proj=pipeline "
"+step +proj=unitconvert +xy_in=deg +xy_out=rad "
- "+step +inv +proj=ob_tran +o_proj=latlon +lat_0=0 +lon_0=180 "
+ "+step +inv +proj=ob_tran +o_proj=latlon +over +lat_0=0 +lon_0=180 "
"+o_lat_p=18 +o_lon_p=-200 +ellps=WGS84 "
"+step +proj=push +v_3 "
"+step +proj=cart +ellps=WGS84 "
@@ -6381,7 +6381,7 @@ TEST(operation, derivedGeographicCRS_with_to_wgs84_to_geographicCRS) {
"+step +proj=helmert +x=-1 +y=-2 +z=-3 "
"+step +inv +proj=cart +ellps=WGS84 "
"+step +proj=pop +v_3 "
- "+step +proj=ob_tran +o_proj=latlon +lat_0=0 +lon_0=180 "
+ "+step +proj=ob_tran +o_proj=latlon +over +lat_0=0 +lon_0=180 "
"+o_lat_p=18 +o_lon_p=-200 +ellps=WGS84 "
"+step +proj=unitconvert +xy_in=rad +xy_out=deg");
EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),