diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-04-23 21:41:00 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-04-23 22:46:08 +0200 |
| commit | d328c1c85c10619777084d7114f58b9c75dc55ca (patch) | |
| tree | b598696fde850513c582222dc3a37cd977798414 /src | |
| parent | 34fde0b4a4c3962d849acab78a305c0bf951988c (diff) | |
| download | PROJ-d328c1c85c10619777084d7114f58b9c75dc55ca.tar.gz PROJ-d328c1c85c10619777084d7114f58b9c75dc55ca.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.cpp | 5 | ||||
| -rw-r--r-- | src/iso19111/io.cpp | 23 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 883e2f32..97d210f0 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -6338,10 +6338,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 6ec0617c..c901f05a 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -4440,7 +4440,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) || |
