From 00dd98457af1f32e7bb2b9677f6319f72fcfacf9 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 23 Jan 2020 13:08:23 +0100 Subject: Database: add a geoid_like value for proj_method column of grid_alternatives, fix related entries and simplify/robustify logic to deal with EPSG 'Geographic3D to GravityRelatedHeight' methods --- src/iso19111/coordinateoperation.cpp | 38 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 6b89b5f3..a8c7c902 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -8495,6 +8495,7 @@ isGeographic3DToGravityRelatedHeight(const OperationMethodNNPtr &method, "1060", // Geographic3D to GravityRelatedHeight (CGG2013) "1072", // Geographic3D to GravityRelatedHeight (OSGM15-Ire) "1073", // Geographic3D to GravityRelatedHeight (IGN2009) + "1081", // Geographic3D to GravityRelatedHeight (BEV AT) "9661", // Geographic3D to GravityRelatedHeight (EGM) "9662", // Geographic3D to GravityRelatedHeight (Ausgeoid98) "9663", // Geographic3D to GravityRelatedHeight (OSGM-GB) @@ -8717,21 +8718,32 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames( if (databaseContext->lookForGridAlternative( filename, projFilename, projGridFormat, inverseDirection)) { - if (filename == projFilename && !inverseDirection) { + if (inverseDirection) { + throw util::UnsupportedOperationException( + "Inverse direction for " + "Geographic3DToGravityRelatedHeight not supported"); + } + + if (filename == projFilename) { return self; } auto parameters = std::vector{ createOpParamNameEPSGCode( EPSG_CODE_PARAMETER_GEOID_CORRECTION_FILENAME)}; +#ifdef disabled_for_now if (inverseDirection) { - return createGravityRelatedHeightToGeographic3D( - createPropertiesForInverse( - self.as_nullable().get(), true, false), - targetCRS(), sourceCRS(), interpolationCRS(), - projFilename, coordinateOperationAccuracies()) + return create(createPropertiesForInverse( + self.as_nullable().get(), true, false), + targetCRS(), sourceCRS(), nullptr, + createSimilarPropertiesMethod(method()), + parameters, {ParameterValue::createFilename( + projFilename)}, + coordinateOperationAccuracies()) ->inverseAsTransformation(); - } else { + } else +#endif + { return create( createSimilarPropertiesTransformation(self), sourceCRS(), targetCRS(), nullptr, @@ -9383,16 +9395,8 @@ void Transformation::_exportToPROJString( fileParameter->type() == ParameterValue::Type::FILENAME) { auto filename = fileParameter->valueFile(); bool doInversion = isMethodInverseOf; - if ((method()->nameStr() == - "Geographic3D to GravityRelatedHeight (US .gtx)" || - method()->nameStr() == - "Geographic3D to GravityRelatedHeight (gtx)") && - ends_with(filename, ".gtx")) { - // gtx files must be applied in - // reverse order for "Geographic3D to GravityRelatedHeight" - // method - doInversion = !doInversion; - } + // The EPSG Geog3DToHeight is the reverse convention of PROJ ! + doInversion = !doInversion; if (doInversion) { formatter->startInversion(); } -- cgit v1.2.3