From 978c68a53c637558e1d7ea254c9937f8d9717ae4 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 17 Mar 2023 13:32:11 +0100 Subject: [PATCH] vgridshift/gridshift: accept hydroid_height as valid band description --- data/tests/test_hydroid_height.tif | Bin 0 -> 1002 bytes .../source/specifications/geodetictiffgrids.rst | 16 +++++++++++++++- src/grids.cpp | 12 ++++++++---- src/transformations/gridshift.cpp | 2 +- test/gie/geotiff_grids.gie | 7 +++++++ test/gie/gridshift.gie | 7 +++++++ 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 data/tests/test_hydroid_height.tif diff --git a/data/tests/test_hydroid_height.tif b/data/tests/test_hydroid_height.tif new file mode 100644 index 0000000000000000000000000000000000000000..4b8db2e162d402b38acb0870a467cd521ffeab8f GIT binary patch literal 1002 zcmebD)MDUZU|-pD0L7W1Y>*B%C>x|lkdXzf_XCh4iX<)u zWrNHVhpPDnR3n3=#ukYk3}rI|)$=v;Fo5U=p!%j39tJibdj^obzMYvt1js%CWH&5f zV%P{|p95kLuyJ>B^zltCNlZyBNwniqP_XeVNzGNrOUzBRRSJm=a8>T775aQ|Yr=(Dvm|KtoG}b^# zp(r23NJ%YDF3Kz@$;{7FvdgGUDay}GiO)#QOwTBR8E2!9>OhFA85l0uLs&2xCXS0f zupcZl!P5bzf)N=0j0`LcAjHVP!~hIzum~t}85y1lfFqcpSh!*iZ@;HUXrjpRZnr|E zc9l~?vojcKpV!>q``+%p^DjxUMS>~0K|Lqdh%FMDm^p(bae{M_+eF81jfo1AV`gv{ z-U!)op=Cj$qT||4LBZZ@ciTL-50~)%-SMz)s^XT*1{MoSEKc1nOHA$&kmTA>WO87; zh~mdd7s4_$UWTs|*VgYcldSA`TJNrI)tLUTQdLO->|^u))Jkcb>*jO z_XK(DSD2Bbm^byqXXl0=CmB);4_#7JtPGUAx9rSUPJOqQT~|-7=1J8G&6F3P7sk1F z<)QoQ8Bf*brfgsMbX!pT+C4I1&y0Dk^`y^*O3CGa+x_dt@%wf8_U85d@9pzntTQc{ zYyM~V>*8a7e(zTNwfCXVWW_y4H*EK~X z>AH~nLGxro{MLoro#(dfmMb&x2$|hod`;2p_@x=yAEc%@&A)s{dCop1m#JKtzJ~(R zW~lE~6gska`Q@V#?ZTJa{zxvpdjId@P>nlUB|fYbo8wo^;=CL&+4YQk|E*mLb6@Il zZ=Uwl@^I0lhn3rkb_Cvd$}v^c>GLa&_q#UDIKgfBQTs%~{L>-Z4{tT}z8H1-EOXl) zcCSByu2CZ9)`vFoCK|ap-&yhf#yshi-seF<&nEo16;yD?NFaM=@3t77t$)}TG@hOX E0DUY!eE`_ + 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)