From 4b44a55f6f2e60230e56f5431120dd3c3e07603f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 10 Feb 2021 15:46:10 +0100 Subject: Allow a BoundCRS to use a PROJ string transformation Related to https://lists.osgeo.org/pipermail/proj/2021-February/010040.html Given test.wkt with ``` BOUNDCRS[ SOURCECRS[ GEOGCRS["unknown", DATUM["Unknown based on GRS80 ellipsoid", ELLIPSOID["GRS 1980",6378137,298.257222101, LENGTHUNIT["metre",1], ID["EPSG",7019]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8901]], CS[ellipsoidal,2], AXIS["longitude",east, ORDER[1], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], AXIS["latitude",north, ORDER[2], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]]]], TARGETCRS[ GEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["latitude",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["longitude",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4326]]], ABRIDGEDTRANSFORMATION["Transformation from unknown to WGS84", METHOD["PROJ-based operation method: +proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=axisswap +order=2,1 +step +proj=cart +ellps=GRS80 +step +proj=helmert +convention=coordinate_frame +exact +step +inv +proj=cart +ellps=WGS84 +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=rad +xy_out=deg"]]] ``` ``projinfo -s @test.wkt -t "WGS 84" -o PROJ -q`` outputs: ``` +proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=axisswap +order=2,1 +step +proj=cart +ellps=GRS80 +step +proj=helmert +convention=coordinate_frame +exact +step +inv +proj=cart +ellps=WGS84 +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=rad +xy_out=deg ``` --- src/iso19111/operation/singleoperation.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/iso19111') diff --git a/src/iso19111/operation/singleoperation.cpp b/src/iso19111/operation/singleoperation.cpp index 0cd7b57a..b32b61cd 100644 --- a/src/iso19111/operation/singleoperation.cpp +++ b/src/iso19111/operation/singleoperation.cpp @@ -2144,6 +2144,18 @@ bool SingleOperation::exportToPROJStringGeneric( return true; } + const char *prefix = "PROJ-based operation method: "; + if (starts_with(method()->nameStr(), prefix)) { + auto projString = method()->nameStr().substr(strlen(prefix)); + try { + formatter->ingestPROJString(projString); + return true; + } catch (const io::ParsingException &e) { + throw io::FormattingException( + std::string("ingestPROJString() failed: ") + e.what()); + } + } + return false; } -- cgit v1.2.3