Im writing a C program for querying height information from SRTM data. Since reading directly GeoTIFF format is tough job, I decided to load HGT format, which serves great for the purpose.
Since SRTM3 data contains void areas, I found the CGIAR preprocesed data which looks much better. But they only offer geotiff download for 5×5° altogether saved in continous numbered filenames (thus not compatible with degree number naming).
I would like to convert these TIF files (ie srtm_39_03.tif) to HGT and name them properly. Or alternatively please suggest another download site.
So far I realised, that I can convert 1° TIF to HGT easily, but 5° fails:
$ gdal_translate -of SRTMHGT srtm_39_02.tif srtm_39_02.hgt Input file size is 6001, 6001 0Warning 1: The corner coordinates of the source are not properly aligned on plain latitude/longitude boundaries. ERROR 1: Image dimensions should be 1201x1201 or 3601x3601.
As of the splitting, it could be probably achieved with
gdal_translate -srcwin 0 0 1201 1201 srtm_39_02.tif out.tif, but Im really confused how to split 6001 in 5 parts each 1201 pixels :-)
Update: according to SRTM manual, HGT files overlap with the 1 upmost/rightmost line, so the splitting is clear now. But still would be happy for consultation.