I have TanDEM-x data and according to the documentation:

"The elevation values represent the ellipsoidal heights relative to the WGS84 ellipsoid in the WGS84-G1150 datum."

I would like to convert this to EGM2008 but I cannot find the right starting EPSG code for the WGS84-G1150 datum. I have tried the following:

gdalwarp  -s_srs EPSG:7661 -t_srs EPSG:6893 TDM1_DEM__04_N04E006_DEM.tif TDM1_DEM__04_N04E006_DEM_EGM08.tif

While this runs and produces an output the elevation pixel values have not changed and so it has not done the datum conversion.

I have also tried:

gdalwarp -srcnodata -32767 -dstnodata -32767 -of GTiff -co COMPRESS=LZW -s_srs "+proj=longlat +datum=WGS84 +no_def" -t_srs "+proj=longlat +datum=WGS84 +no_defs +geoidgrids=egm2008.gtx" TDM1_DEM__04_N04E006_DEM.tif TDM1_DEM__04_N04E006_DEM_EGM08.tif

but this also does not do the datum conversion.

Does anyone know how to do this conversion in gdal or python?


The EGM2008 model isn't precise enough for it to matter which realization of WGS 1984 is used to interpolate the offsets. WGS 84 realizations, particularly the later ones differ by centimeters, maybe as much as a decimeter between the current one and one of the first few. The better EGM2008 model has cell size of 1' x 1' (1x1 minute). One minute at the equator is about 1.8 km.

The EPSG entries for geographic CRS are:

WGS 84 (G1150)    9055    geographic 2D (latitude-longitude)
WGS 84 (G1150)    7660    geocentric (XYZ)
WGS 84 (G1150)    7661    geographic 3D (latitude-longitude-h)

Your input data is 7661. However, you're trying to convert to 6893, WGS 84 / World Mercator + EGM2008 height. The software may not be able to piece together coordinate operations (transformations) to do the conversions. You might want to try setting the source 4979, which is the generic WGS 84 using geographic 3D as that matches the horizontal/latitude-longitude portion with your output CRS.

I don't know if gdal will automatically pick and use the coordinate operation. You want either 3858 or 3859 which convert between WGS 84 ellipsoid and geoid heights/elevations using the EGM2008 geoid models. 3858 is the 2.5x2.5 minute model while 3859 is the 1x1 minute model. You need to check that you have at least one of these grid files downloaded.

Disclosure: I'm a member of the subcommittee that maintains the EPSG Registry. I work for Esri and I don't know the details of how gdal or PROJ (which is uses) work.

  • Thanks, this is useful information. There's obviously some basic info here that I don't know so this answer is really helpful. Like you say, im not sure if GDAL is capable of piecing together the coordinate operations to to the conversions. This is great starting info I can use to move forward – Nathan Thomas Nov 11 '20 at 21:01

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.