I'm trying to do the following:

Given a list of WGS84 latitude / longitude pairs in a text file (one pair per line), I'd like to compute the EGM96 and EGM2008 elevations corresponding to those points using GDAL. Unfortunately, it seems gdalwarp is usually used to convert from one SRID to another, not the use case I'm looking for.

I'm sure there must be a way - I'd prefer to use GDAL for this task (as I've been recommended to use it), but I'm happy to consider other (command-line) alternatives to solving the same taks.

EDIT: MATLAB gives me the exact API I'm looking for


But I don't have access to MATLAB and it seems GDAL does have the same capabilities, if only I could find it!

1 Answer 1


For this type of work I would get the EGM96 or EGM2008 elevation raster data. Then if you want to go just with GDAL, look at the LocationInfo function to extract for each pair of XY locationsthe corresponding EGM value. https://gdal.org/programs/gdallocationinfo.html

I believe you can get both EGM models in raster format from: https://earth-info.nga.mil/GandG/update/index.php?action=home and then just iterate through your X,Y locations to get the required information. I am expecting you have to write a batch job or something.

The easier route would be using QGIS, as it has a function called Sample Raster Values, where you can feed the function a point layer (your X,Y table loaded as point data) and the raster from which to sample (EGM96/EGM2008 in your case). Run for all X,Y locations and you get the information you want.

You could run it with your X,Y locations against the EGM96 raster, take the output from that first run and use it in the function again, but this time against the EGM2008 raster. You will finally have a nice point layer, with both EGM96 and EGM08 values as attributes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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