diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-04-23 21:41:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-23 21:41:00 +0200 |
| commit | 40466db40499e003cc59957d7e245b6ce8f8e4a3 (patch) | |
| tree | a879f7919eabf5e8f9c8cbeb1ae54c5e81d66155 /src | |
| parent | b0e5448982b4e12db9a664ac96089a14375cb55d (diff) | |
| download | PROJ-40466db40499e003cc59957d7e245b6ce8f8e4a3.tar.gz PROJ-40466db40499e003cc59957d7e245b6ce8f8e4a3.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 4ae5f8a6..ec515cd7 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -6380,10 +6380,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 260cf1c7..86f21db7 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -4514,7 +4514,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) || |
