aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-04-23 21:41:00 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-04-23 21:46:40 +0200
commit079f53c2dbb93c435ba833c935eab89c610c80ec (patch)
treef1a4a1a1f2ab0522b8cc0cff08f943397c283d3a /src
parentcea52c3735ba7442356eb97708ef3f3ea57e60b1 (diff)
downloadPROJ-079f53c2dbb93c435ba833c935eab89c610c80ec.tar.gz
PROJ-079f53c2dbb93c435ba833c935eab89c610c80ec.zip
Fix support of WKT1_GDAL with netCDF rotated pole formulation (#2185)
Contributes to fixing issue raised in https://lists.osgeo.org/pipermail/gdal-dev/2020-April/052003.html
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp5
-rw-r--r--src/iso19111/io.cpp23
2 files changed, 24 insertions, 4 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 9970254d..1e8e0a4c 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -6344,10 +6344,9 @@ void Conversion::_exportToPROJString(
auto derivedGeographicCRS =
dynamic_cast<const crs::DerivedGeographicCRS *>(horiz);
- if (derivedGeographicCRS) {
- auto baseGeodCRS = derivedGeographicCRS->baseCRS();
+ if (!formatter->getCRSExport() && derivedGeographicCRS) {
formatter->setOmitProjLongLatIfPossible(true);
- baseGeodCRS->_exportToPROJString(formatter);
+ derivedGeographicCRS->addAngularUnitConvertAndAxisSwap(formatter);
formatter->setOmitProjLongLatIfPossible(false);
}
}
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 7cb46b28..27326484 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -4469,7 +4469,28 @@ CRSPtr WKTParser::Private::buildCRS(const WKTNodeNNPtr &node) {
if (ci_equal(name, WKTConstants::PROJCS) ||
ci_equal(name, WKTConstants::PROJCRS) ||
ci_equal(name, WKTConstants::PROJECTEDCRS)) {
- return util::nn_static_pointer_cast<CRS>(buildProjectedCRS(node));
+ auto projCRS =
+ util::nn_static_pointer_cast<CRS>(buildProjectedCRS(node));
+ auto projString = projCRS->getExtensionProj4();
+ if (starts_with(projString, "+proj=ob_tran +o_proj=longlat") ||
+ starts_with(projString, "+proj=ob_tran +o_proj=lonlat") ||
+ starts_with(projString, "+proj=ob_tran +o_proj=latlong") ||
+ starts_with(projString, "+proj=ob_tran +o_proj=latlon")) {
+ // Those are not a projected CRS, but a DerivedGeographic one...
+ if (projString.find(" +type=crs") == std::string::npos) {
+ projString += " +type=crs";
+ }
+ try {
+ auto projObj =
+ PROJStringParser().createFromPROJString(projString);
+ auto crs = nn_dynamic_pointer_cast<CRS>(projObj);
+ if (crs) {
+ return crs;
+ }
+ } catch (const io::ParsingException &) {
+ }
+ }
+ return projCRS.as_nullable();
}
if (ci_equal(name, WKTConstants::VERT_CS) ||