I'm transforming some SRTM *hgt files (1 second resolution version) to GRD format using dal_translate. For example, one of my orders is:

gdal_translate -of AAIGrid N43W001.hgt N43W001.grd

The center of pixel coordinates for the lower left position in this file are lat=43º, lon=-1º, but the transformed GRD file has lower left coordinates lat=42.999861111111º, lon=-1.000138888889º, i.e., the coordinates correspond to the lower left corner of the lower left pixel, intead of its center.

I can't find any option in gdal_translate in order to deal with this problem. Am I using gdal_translate in an incorrect way?

  • Can you use the -a_ullr argument to shift the bounds of the raster by 1/2 the resolution so that the cells align? Also check the blurb about AREA_OR_POINT metadata (here)[gdal.org/gdal_datamodel.html]. The default in GDAL is area, but this is just a flag. – Rob Skelly Dec 24 '15 at 23:28

I don't see any bug in this. If you look at https://en.wikipedia.org/wiki/Esri_grid, you see that xllcorner and yllcorner do not descibe the center of the pixel, but rather the extent of the whole image.

Hgt files define the averaged height at the center of the pixel. The data is split at full degrees, and so the first and last row and column is always present in the neighbouring file as well:

enter image description here

If you need cell center coordinates, try the XYZ format:

-1 44 89
-0.99916666666666676 44 88
-0.99833333333333341 44 89
-0.99750000000000005 44 90
-0.0024999999999999467 43 1300
-0.0016666666666667052 43 1329
-0.00083333333333335258 43 1359
0 43 1376

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.