Question

I'm using GDAL java API. I have a code piece converting SRTM (hgt), geotiff and dted files to each other.

While testing the code, I SUCCESSFULLY converted a sample hgt file (downloaded from internet such as from this site:http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/) to dted format.

But when I use a geotiff file and successfully convert it to hgt file using my conversion code and then feed this converted hgt file to convert it to dted format, inputDataSet is returned null.

When I check API documentation, it says there must be something wrong in the file structure.

How can I overcome this problem? Does Gdal Java API have a method to tell me what's wrong with this hgt file?

Code Fragment:

....
gdal.AllRegister();
inputDataset=gdal.Open(inputImagePath);
....

Note: I am re-emphasizing for the sake of clarity, this code is working for a hgt file downloaded from internet. The problem is in feeding in an aldready converted file to the converter again.

Was it helpful?

Solution

We concluded that for hgt files not only the file content but also the name of the file is important. For example N00E072.hgt: File name refers to the latitude and longitude of the lower left corner of the tile. If the file name does not conform to this format, error occurs during the transformation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top