Is there a tool available in gdal to do vertical datum conversion of a raster DEM? I'm looking for a single command line to execute the vertical datum conversion of a raster like the las2las of Liblas does for Point Cloud data.

I found out that gdalwarp were not doing this conversion even if the .gtx grid shift file exist in the PROJ_LIB folder and is correctly set in gdal.

I was able to do vertical datum conversion of a coordinate with gdaltransform, but I can't find a way to do the conversion for a complete raster file.


Convert from (EGM96) geoid vertical datum to (WGS84) ellipsoid vertical datum:

gdalwarp -s_srs "+proj=longlat +datum=WGS84 +no_defs +geoidgrids=egm96_15.gtx" -t_srs "+proj=longlat +datum=WGS84 +no_def" dem_in_egm96_geoid.tif dem_in_wgs84_ellipsoid.tif

You will need the gtx file containing vertical datum shifts from here: http://download.osgeo.org/proj/vdatum/egm96_15/

See this page for more info: https://github.com/OSGeo/proj.4/wiki/VerticalDatums

You can test the result at a location using this site: http://jules.unavco.org/Geoid/Geoid

  • 2
    I'm using GDAL 3.* and Windows 10 with Windows PowerShell and I had to add a ./ to the egm96_15.gtx file so gdal would find it. Without specifying this local directory I was getting a "Cannot open" file error. gdalwarp -s_srs "+proj=longlat +datum=WGS84 +no_defs +geoidgrids=./egm96_15.gtx" -t_srs "+proj=longlat +datum=WGS84 +no_def" dem_in_egm96_geoid.tif dem_in_wgs84_ellipsoid.tif Otherwise, this looks like it worked well for me while other top Google hits for this conversion didn't work.
    – Brandon
    Jun 16 '20 at 21:04

This answer isn't a single command, but I'll put it in to get the ball rolling. Use gdalwarp to resample the geoid grid, then gdal_calc.py to shift the original raster.

gdalwarp -s_srs epsg:4326 -t_srs epsg:26910 -r cubic -tr 10 10 -tap HT2_0.gtx HT2_0_resampled.tif
gdal_calc.py -A original.tif -B HT2_0_resampled.tif --calc="A+B" --outfile=shifted.tif

If original is a 10mx10m raster with grid origin at 0,0, UTM10N and contains orthometric heights, shifted.tif will contain ellipsoidal heights.

(Obviously, the geoid raster would be huge. One should crop it at the same time to speed things up/save space.)

Edit: GDAL >= 2.2 can now perform vertical datum transformations using the updated capabilities of Proj4. For example, with gdalwarp you'd use -s_srs and -t_srs with a vertical and horizontal SRID, like: gdalwarp ... -t_srs epsg:2956+3567 which gives you NAD83(CSRS) UTM12N with CGVD27 (if memory serves.)


See the direct function (dem_geoid) for geoid conversion available in the NASA Ames Stereo Pipeline(https://ti.arc.nasa.gov/tech/asr/groups/intelligent-robotics/ngt/stereo/).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.