I have a 30-by-30 tile from http://srtm.csi.cgiar.org/srtmdata/


Later I pre-process as outlined in the previous question CGIAR DEM + gdalwarp -- projection to Cartesian is not happening (see the question and the answer therein).

After this, I run gdal_translate -of XYZ result_europe.tmerc.tif europe.xyz, but head europe.xyz yields

1455914.01239279192 -1554769.20640147454 -32768
1455993.40596163366 -1554769.20640147454 -32768
1456072.79953047587 -1554769.20640147454 -32768
1456152.19309931761 -1554769.20640147454 -32768
1456231.58666815935 -1554769.20640147454 -32768
1456310.98023700155 -1554769.20640147454 -32768
1456390.37380584329 -1554769.20640147454 -32768
1456469.7673746855 -1554769.20640147454 -32768
1456549.16094352724 -1554769.20640147454 -32768
1456628.55451236898 -1554769.20640147454 -32768

Same story with tail. So I presume all of them are missing values. How to fix this?


Using the coordinate system that you are means that both in the beginning and in the end of the file you will have lots and lots of nodata values. Now, the way that the gdal version of the XYZ format works means that -32768 is the value chosen for nodata. With that in mind, you'll have to remove all those nodata values, which is a bit of work.
How you go about removing those lines with nodata is going to depend a lot on which tools you are comfortable with.

  • Currently I am running something like this: cat europe.xyz | sed '/\s\+-32768$/d' > europe_curated.xyz. So this is not unusual, then, to have those nodata values after all the transformations. – Ilonpilaaja Apr 4 at 15:15

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.