aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/operation/singleoperation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-02-10 15:46:10 +0100
committerEven Rouault <even.rouault@spatialys.com>2021-02-10 15:48:29 +0100
commit4b44a55f6f2e60230e56f5431120dd3c3e07603f (patch)
treed825f44742426ab69058e25133984515da612b7f /src/iso19111/operation/singleoperation.cpp
parenta7f6b407446b35a50b5601650aed993c706fe8ee (diff)
downloadPROJ-4b44a55f6f2e60230e56f5431120dd3c3e07603f.tar.gz
PROJ-4b44a55f6f2e60230e56f5431120dd3c3e07603f.zip
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 ```
Diffstat (limited to 'src/iso19111/operation/singleoperation.cpp')
-rw-r--r--src/iso19111/operation/singleoperation.cpp12
1 files changed, 12 insertions, 0 deletions
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;
}