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/iso19111/io.cpp | |
| 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/iso19111/io.cpp')
| -rw-r--r-- | src/iso19111/io.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
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) || |
