I have two tiles for SRTM1 for the same bounding box region, but downloaded from two sources.

I read a value for a given latitude and longitude with python. I get always a difference of one meter for the same latitude and longitude, I changed random numbers within the boundary, the same problem remains. Then I opened both the hgt files with binary viewer, indeed there are not the same in binary. My question is, which one should I trust and from where comes this error.

My python code:

import numpy as np

file_1 = 'n34e036.hgt'   #Source of file is from the link above

file_2 = 'N34E036.hgt'   #Source of file is from the link above

SAMPLES = 3601 # Change this to 1201 for SRTM3

def read_elevation_from_file(hgt_file, lon, lat):
    with open(hgt_file, 'rb') as hgt_data:
        # Each data is 16bit signed integer(i2) - big endian(>)
        elevations = np.fromfile(hgt_data, np.dtype('>i2'), SAMPLES*SAMPLES).reshape((SAMPLES, SAMPLES))
        lat_row = int(round((lat - int(lat)) * (SAMPLES - 1), 0))
        lon_row = int(round((lon - int(lon)) * (SAMPLES - 1), 0))
    return elevations[SAMPLES - 1 - lat_row, lon_row].astype(int)

#test example
lat = 34.0 + (3599.0/3600.0)
lon = 36.0 + (4.0/3600.0)

elv_1 = read_elevation_from_file(file_1,lon,lat)
elv_2 = read_elevation_from_file(file_2,lon,lat)

print(elv_1)  # this yields 423
print(elv_2)  # this yields 422

Edit: I tried also for tile N52E009.hgt, there is also difference but here for two meters.

In binary viewer: The right side is for file_2 and the left side for file_1 viewed as binary


You should trust the one from NASA's MEaSUREs project.

Both dataset are based on the data collected by the space Shuttle in February 2000 (SRTM mission) but the processing and calibration procedure is different, and perhaps those differences account for the 1 meter offset you are observing. But the MEaSUREs NASADEM objective was precisely to re-process SRTM data with the latest technology and more calibration and validation data. Therefore, I would trust that one.

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.