Skip to content

Commit

Permalink
Take into account renaming of 'Geoid undulation' to 'Geoid height' pa…
Browse files Browse the repository at this point in the history
…rameter
  • Loading branch information
rouault committed Dec 5, 2024
1 parent 5334e3d commit 4403aa0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/iso19111/operation/conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4607,7 +4607,7 @@ ConversionNNPtr Conversion::createGeographic2DWithHeightOffsets(
VectorOfParameters{
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LATITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_GEOID_UNDULATION)},
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_GEOID_HEIGHT)},
VectorOfValues{offsetLat, offsetLong, offsetHeight});
}

Expand Down
23 changes: 17 additions & 6 deletions src/iso19111/operation/parammappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,8 @@ const struct ParamNameCode gParamNameCodes[] = {
PARAM_NAME_CODE(VERTICAL_OFFSET),
PARAM_NAME_CODE(EASTING_OFFSET),
PARAM_NAME_CODE(NORTHING_OFFSET),
PARAM_NAME_CODE(GEOID_UNDULATION),
PARAM_NAME_CODE(GEOID_HEIGHT),
PARAM_NAME_CODE(GEOID_UNDULATION), // deprecated
PARAM_NAME_CODE(A0),
PARAM_NAME_CODE(A1),
PARAM_NAME_CODE(A2),
Expand Down Expand Up @@ -1341,13 +1342,12 @@ static const ParamMapping paramLatitudeOffset = {
static const ParamMapping *const paramsGeographic2DOffsets[] = {
&paramLatitudeOffset, &paramLongitudeOffset, nullptr};

static const ParamMapping paramGeoidUndulation = {
EPSG_NAME_PARAMETER_GEOID_UNDULATION, EPSG_CODE_PARAMETER_GEOID_UNDULATION,
nullptr, common::UnitOfMeasure::Type::LINEAR, nullptr};
static const ParamMapping paramGeoidHeight = {
EPSG_NAME_PARAMETER_GEOID_HEIGHT, EPSG_CODE_PARAMETER_GEOID_HEIGHT, nullptr,
common::UnitOfMeasure::Type::LINEAR, nullptr};

static const ParamMapping *const paramsGeographic2DWithHeightOffsets[] = {
&paramLatitudeOffset, &paramLongitudeOffset, &paramGeoidUndulation,
nullptr};
&paramLatitudeOffset, &paramLongitudeOffset, &paramGeoidHeight, nullptr};

static const ParamMapping paramVerticalOffset = {
EPSG_NAME_PARAMETER_VERTICAL_OFFSET, EPSG_CODE_PARAMETER_VERTICAL_OFFSET,
Expand All @@ -1370,6 +1370,9 @@ static const ParamMapping *const paramsCartesianGridOffsets[] = {
static const ParamMapping *const paramsVerticalOffsets[] = {
&paramVerticalOffset, nullptr};

static const ParamMapping *const paramsGeographic3DToGravityRelatedHeight[] = {
&paramGeoidHeight, nullptr};

static const ParamMapping paramInclinationInLatitude = {
EPSG_NAME_PARAMETER_INCLINATION_IN_LATITUDE,
EPSG_CODE_PARAMETER_INCLINATION_IN_LATITUDE, nullptr,
Expand Down Expand Up @@ -1607,6 +1610,14 @@ static const MethodMapping gOtherMethodMappings[] = {
{EPSG_NAME_METHOD_VERTICAL_OFFSET, EPSG_CODE_METHOD_VERTICAL_OFFSET,
nullptr, nullptr, nullptr, paramsVerticalOffsets},

{EPSG_NAME_METHOD_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT,
EPSG_CODE_METHOD_GEOGRAPHIC3D_TO_GRAVITYRELATEDHEIGHT, nullptr, nullptr,
nullptr, paramsGeographic3DToGravityRelatedHeight},

{EPSG_NAME_METHOD_GEOGRAPHIC3D_TO_GEOG2D_GRAVITYRELATEDHEIGHT,
EPSG_CODE_METHOD_GEOGRAPHIC3D_TO_GEOG2D_GRAVITYRELATEDHEIGHT, nullptr,
nullptr, nullptr, paramsGeographic3DToGravityRelatedHeight},

{EPSG_NAME_METHOD_VERTICAL_OFFSET_AND_SLOPE,
EPSG_CODE_METHOD_VERTICAL_OFFSET_AND_SLOPE, nullptr, nullptr, nullptr,
paramsVerticalOffsetAndSlope},
Expand Down
2 changes: 1 addition & 1 deletion src/iso19111/operation/singleoperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3860,7 +3860,7 @@ bool SingleOperation::exportToPROJStringGeneric(
parameterValueNumeric(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET,
common::UnitOfMeasure::ARC_SECOND);
double offsetHeight =
parameterValueNumericAsSI(EPSG_CODE_PARAMETER_GEOID_UNDULATION);
parameterValueNumericAsSI(EPSG_CODE_PARAMETER_GEOID_HEIGHT);

auto sourceCRSGeog =
dynamic_cast<const crs::GeographicCRS *>(sourceCRS().get());
Expand Down
4 changes: 2 additions & 2 deletions src/iso19111/operation/transformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ TransformationNNPtr Transformation::createGeographic2DWithHeightOffsets(
VectorOfParameters{
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LATITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_GEOID_UNDULATION)},
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_GEOID_HEIGHT)},
VectorOfValues{offsetLat, offsetLong, offsetHeight}, accuracies);
}

Expand Down Expand Up @@ -1680,7 +1680,7 @@ TransformationNNPtr Transformation::inverseAsTransformation() const {
offsetLong.unit());

const auto &offsetHeight =
parameterValueMeasure(EPSG_CODE_PARAMETER_GEOID_UNDULATION);
parameterValueMeasure(EPSG_CODE_PARAMETER_GEOID_HEIGHT);
const common::Length newOffsetHeight(negate(offsetHeight.value()),
offsetHeight.unit());

Expand Down
7 changes: 4 additions & 3 deletions src/proj_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,6 @@
"Geog3D to Geog2D+GravityRelatedHeight"
#define EPSG_CODE_METHOD_GEOGRAPHIC3D_TO_GEOG2D_GRAVITYRELATEDHEIGHT 1131

#define EPSG_NAME_PARAMETER_GEOID_HEIGHT "Geoid height"
#define EPSG_CODE_PARAMETER_GEOID_HEIGHT 8604

/* ------------------------------------------------------------------------ */

#define PROJ_WKT2_NAME_METHOD_HEIGHT_TO_GEOG3D \
Expand Down Expand Up @@ -777,6 +774,10 @@
#define EPSG_NAME_PARAMETER_VERTICAL_OFFSET "Vertical Offset"
#define EPSG_CODE_PARAMETER_VERTICAL_OFFSET 8603

#define EPSG_NAME_PARAMETER_GEOID_HEIGHT "Geoid height"
#define EPSG_CODE_PARAMETER_GEOID_HEIGHT 8604

/* Geoid undulation is the name before EPSG v11.023 */
#define EPSG_NAME_PARAMETER_GEOID_UNDULATION "Geoid undulation"
#define EPSG_CODE_PARAMETER_GEOID_UNDULATION 8604

Expand Down

0 comments on commit 4403aa0

Please sign in to comment.