diff --git a/data/tests/test_hydroid_height.tif b/data/tests/test_hydroid_height.tif new file mode 100644 index 0000000000..4b8db2e162 Binary files /dev/null and b/data/tests/test_hydroid_height.tif differ diff --git a/docs/source/specifications/geodetictiffgrids.rst b/docs/source/specifications/geodetictiffgrids.rst index 95378ac7d0..584e9dd630 100644 --- a/docs/source/specifications/geodetictiffgrids.rst +++ b/docs/source/specifications/geodetictiffgrids.rst @@ -289,10 +289,24 @@ is an easy way to inspect such grid files: is expressed in the target CRS) to get an ellipsoidal height (that is expressed in the source CRS), also called the geoid undulation. + The value is positive upward from the reference ellipsoid. Note the possible confusion related to what is the source CRS and target CRS and the semantics of the value stored (to convert from the source to the target, one must subtract the value contained in the grid). This is the convention - used by the `EPSG:9665 `_ + used by the `EPSG:9665 `_ + operation method. + + + ``hydroid_height``: valid for TYPE=VERTICAL_OFFSET_GEOGRAPHIC_TO_VERTICAL. + For a source CRS being a geographic CRS and a target CRS being a vertical CRS + representing a tidal surface (typically Chart Datum, Highest/Lowest Astronomical + Tide (HAT/LAT), High/Low Waters, Mean Sea Level), the hydroid height is + the value to add to a height related to a tidal surface (that is expressed + in the target CRS) to get an ellipsoidal height (that is expressed in the source CRS). + The value is positive upward from the reference ellipsoid. + Note the possible confusion related to what is the source CRS and target CRS and + the semantics of the value stored (to convert from the source to the target, + one must subtract the value contained in the grid). This is the convention + used by the `EPSG:1115 `_ operation method. + ``vertical_offset``: valid for TYPE=VERTICAL_OFFSET_VERTICAL_TO_VERTICAL. diff --git a/src/grids.cpp b/src/grids.cpp index 8d4c01e6f9..e1829a9a67 100644 --- a/src/grids.cpp +++ b/src/grids.cpp @@ -1538,7 +1538,7 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, } } - // Identify the index of the geoid_undulation/vertical_offset + // Identify the index of the vertical correction bool foundDescriptionForAtLeastOneSample = false; bool foundDescriptionForShift = false; for (int i = 0; i < static_cast(grid->samplesPerPixel()); ++i) { @@ -1546,7 +1546,9 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, if (!desc.empty()) { foundDescriptionForAtLeastOneSample = true; } - if (desc == "geoid_undulation" || desc == "vertical_offset") { + if (desc == "geoid_undulation" || desc == "vertical_offset" || + desc == "hydroid_height" || + desc == "ellipsoidal_height_offset") { idxSample = static_cast(i); foundDescriptionForShift = true; } @@ -1561,13 +1563,15 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, // IFD for example pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has no " - "geoid_undulation/vertical_offset channel", + "geoid_undulation/vertical_offset/hydroid_height/" + "ellipsoidal_height_offset channel", ifd); continue; } else { pj_log(ctx, PJ_LOG_DEBUG, "IFD 0 has channel descriptions, but no " - "geoid_undulation/vertical_offset channel"); + "geoid_undulation/vertical_offset/hydroid_height/" + "ellipsoidal_height_offset channel"); return nullptr; } } diff --git a/src/transformations/gridshift.cpp b/src/transformations/gridshift.cpp index e6557494fc..2d473b03d7 100644 --- a/src/transformations/gridshift.cpp +++ b/src/transformations/gridshift.cpp @@ -211,7 +211,7 @@ PJ_LPZ gridshiftData::grid_interpolate(PJ_CONTEXT *ctx, const std::string &type, return val; } } else if (desc == "ellipsoidal_height_offset" || - desc == "geoid_undulation" || + desc == "geoid_undulation" || desc == "hydroid_height" || desc == "vertical_offset") { idxSampleZ = i; const auto unit = grid->unit(idxSampleZ); diff --git a/test/gie/geotiff_grids.gie b/test/gie/geotiff_grids.gie index 7e03d20aab..f222c2aeb5 100644 --- a/test/gie/geotiff_grids.gie +++ b/test/gie/geotiff_grids.gie @@ -148,6 +148,13 @@ accept 4.05 52.1 0 expect 4.05 52.1 10 ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +operation +proj=vgridshift +grids=tests/test_hydroid_height.tif +multiplier=1 +------------------------------------------------------------------------------- +accept 2 49 0 +expect 2 49 44.643493652 +------------------------------------------------------------------------------- + ------------------------------------------------------------------------------- operation +proj=vgridshift +grids=tests/test_vgrid_invalid_channel_type.tif +multiplier=1 ------------------------------------------------------------------------------- diff --git a/test/gie/gridshift.gie b/test/gie/gridshift.gie index 4426bc3e8f..86de12346e 100644 --- a/test/gie/gridshift.gie +++ b/test/gie/gridshift.gie @@ -93,6 +93,13 @@ expect failure errno coord_transfm_outside_grid accept -179.816 54.5 0 expect failure errno coord_transfm_outside_grid +------------------------------------------------------------------------------- +operation +proj=gridshift +grids=tests/test_hydroid_height.tif +------------------------------------------------------------------------------- +accept 2 49 0 +expect 2 49 44.643493652 +------------------------------------------------------------------------------- + ---------------------------------------------------------------------- # Geographic 3D offsets with quadratic interpolation (defined in file)