SRTM DEM – Understanding Cell Value Reference in SRTM DEM Files

demsrtm

I'm working with srtm dem files. They are ascii text files containing a table/grid of elevation values. At the top of the file is some metadata to locate the grid in lat/lon:

xllcorner -124.00041606132

yllcorner 48.999583599682

cellsize 0.00083333333333333

So initially I thought of the cells as points and assumed that the first value in the grid was the elevation for a point located at (xllcorner, yllcorner), and that the second value in the grid was the elevation at (xllcorner + cellsize, yllcorner). I then used this data to draw a 3d mesh with the mesh vertices corresponding to cells in the grid.

The resulting mesh looks correct but now I'm wondering if it's out by (cellsize / 2) in lat and lon…

When I started working with the file using Postgis Raster I discovered that it considers each cell as a polygon rather than a point. Rather than the first value representing the elevation for the point (xllcorner, yllcorner) it actually represents the the elevation for the polygon (xllcorner, yllcorner, xllcorner + cellsize, yllcorner + cellsize).

So, with that in mind, and seeing that I need to map each elevation to a point. Is it more accurate to say that the first value in the grid represents the elevation at (xllcorner, yllcorner) or at (xllcorner + cellsize / 2, yllcorner + cellsize / 2)?

Best Answer

Here's what the original NASA's SRTM document says (emphasis is mine):

File names refer to the latitude and longitude of the lower left corner of the tile - e.g. N37W105 has its lower left corner at 37 degrees north latitude and 105 degrees west longitude. To be more exact, these coordinates refer to the geometric center of the lower left pixel, which in the case of SRTM3 data will be about 90 meters in extent.

What you have is an ASCII grid file. I've seen two types of these: one type defines the grid using xllcorner/yllcorner, the other using xllcenter/yllcenter, but both are essentially the same.

So, with that in mind, and seeing that I need to map each elevation to a point. Is it more accurate to say that the first value in the grid represents the elevation at (xllcorner, yllcorner) or at (xllcorner + cellsize / 2, yllcorner + cellsize / 2)?

SRTM height represents the (average) height of all points within the cell, which has a bounding box (xllcorner, yllcorner, xllcorner + cellsize, yllcorner + cellsize). The center of that cell is xllcorner + cellsize/2, yllcorner + cellsize/2. So, basically, the answer to your question is: use the center of the cell to represent the height point.

I would also suggest running some TIN simplification algorithm on your mesh to reduce its size, that's what I did for my project.