aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp70
-rw-r--r--src/proj_constants.h6
2 files changed, 29 insertions, 47 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index a1650046..6b89b5f3 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -8647,7 +8647,10 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
inverseDirection)) {
if (horizontalGridName == projFilename) {
- assert(!inverseDirection);
+ if (inverseDirection) {
+ throw util::UnsupportedOperationException(
+ "Inverse direction for " + projFilename + " not supported");
+ }
return self;
}
@@ -8704,33 +8707,6 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
}
}
- const auto &heightFilename = getHeightToGeographic3DFilename();
- if (!heightFilename.empty() && !projFilename.empty()) {
- if (databaseContext->lookForGridAlternative(
- heightFilename, projFilename, projGridFormat,
- inverseDirection)) {
-
- if (heightFilename == projFilename) {
- assert(!inverseDirection);
- return self;
- }
-
- if (inverseDirection) {
- return createGravityRelatedHeightToGeographic3D(
- createPropertiesForInverse(self.as_nullable().get(),
- true, false),
- targetCRS(), sourceCRS(), interpolationCRS(),
- projFilename, coordinateOperationAccuracies())
- ->inverseAsTransformation();
- } else {
- return createGravityRelatedHeightToGeographic3D(
- createSimilarPropertiesTransformation(self), sourceCRS(),
- targetCRS(), interpolationCRS(), projFilename,
- coordinateOperationAccuracies());
- }
- }
- }
-
if (isGeographic3DToGravityRelatedHeight(method(), false)) {
const auto &fileParameter =
parameterValue(EPSG_NAME_PARAMETER_GEOID_CORRECTION_FILENAME,
@@ -8741,8 +8717,7 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
if (databaseContext->lookForGridAlternative(
filename, projFilename, projGridFormat, inverseDirection)) {
- if (filename == projFilename) {
- assert(!inverseDirection);
+ if (filename == projFilename && !inverseDirection) {
return self;
}
@@ -8750,13 +8725,11 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
createOpParamNameEPSGCode(
EPSG_CODE_PARAMETER_GEOID_CORRECTION_FILENAME)};
if (inverseDirection) {
- return create(createPropertiesForInverse(
- self.as_nullable().get(), true, false),
- targetCRS(), sourceCRS(), nullptr,
- createSimilarPropertiesMethod(method()),
- parameters, {ParameterValue::createFilename(
- projFilename)},
- coordinateOperationAccuracies())
+ return createGravityRelatedHeightToGeographic3D(
+ createPropertiesForInverse(
+ self.as_nullable().get(), true, false),
+ targetCRS(), sourceCRS(), interpolationCRS(),
+ projFilename, coordinateOperationAccuracies())
->inverseAsTransformation();
} else {
return create(
@@ -8771,7 +8744,8 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
}
if (methodEPSGCode == EPSG_CODE_METHOD_VERTCON ||
- methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_NZLVD) {
+ methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_NZLVD ||
+ methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_GTX) {
auto fileParameter =
parameterValue(EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE,
EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE);
@@ -8783,7 +8757,11 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
filename, projFilename, projGridFormat, inverseDirection)) {
if (filename == projFilename) {
- assert(!inverseDirection);
+ if (inverseDirection) {
+ throw util::UnsupportedOperationException(
+ "Inverse direction for " + projFilename +
+ " not supported");
+ }
return self;
}
@@ -9405,13 +9383,12 @@ void Transformation::_exportToPROJString(
fileParameter->type() == ParameterValue::Type::FILENAME) {
auto filename = fileParameter->valueFile();
bool doInversion = isMethodInverseOf;
- if (!identifiers().empty() &&
- *identifiers().front()->codeSpace() ==
- metadata::Identifier::EPSG &&
- method()->nameStr() ==
- "Geographic3D to GravityRelatedHeight (US .gtx)" &&
+ if ((method()->nameStr() ==
+ "Geographic3D to GravityRelatedHeight (US .gtx)" ||
+ method()->nameStr() ==
+ "Geographic3D to GravityRelatedHeight (gtx)") &&
ends_with(filename, ".gtx")) {
- // gtx files, from straight EPSG definition, must be applied in
+ // gtx files must be applied in
// reverse order for "Geographic3D to GravityRelatedHeight"
// method
doInversion = !doInversion;
@@ -9445,7 +9422,8 @@ void Transformation::_exportToPROJString(
}
}
- if (methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_NZLVD) {
+ if (methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_NZLVD ||
+ methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_GTX) {
auto fileParameter =
parameterValue(EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE,
EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE);
diff --git a/src/proj_constants.h b/src/proj_constants.h
index 21cd87fb..d5b484c6 100644
--- a/src/proj_constants.h
+++ b/src/proj_constants.h
@@ -511,11 +511,15 @@
/* ------------------------------------------------------------------------ */
#define EPSG_CODE_METHOD_VERTCON 9658
-#define EPSG_NAME_METHOD_VERTCON "VERTCON"
+#define EPSG_NAME_METHOD_VERTCON_OLDNAME "VERTCON"
+#define EPSG_NAME_METHOD_VERTCON "Vertical Offset by Grid Interpolation (VERTCON)"
#define EPSG_CODE_METHOD_VERTICALGRID_NZLVD 1071
#define EPSG_NAME_METHOD_VERTICALGRID_NZLVD "Vertical Offset by Grid Interpolation (NZLVD)"
+#define EPSG_CODE_METHOD_VERTICALGRID_GTX 1084
+#define EPSG_NAME_METHOD_VERTICALGRID_GTX "Vertical Offset by Grid Interpolation (gtx)"
+
#define EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE "Vertical offset file"
#define EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE 8732