[GIS] Using Latitude and Longitude with SRTM3 DEM file

cdemsrtm

I am new to working with DEM files but have a need to be able to work with SRTM3 DEM files to calculate elevation given a Lat,lon coordinates.

I understand from reading the documentation that the file contains binary data that represents Signed Int16 data that has height in meters.

My question is this, given a file say that has its bottom left corner being -33, 152 and covers 1 degree of lat, long how would do read a location in the file based on a given latitude, longitude point.

So if I had a position that was -33.456 152.434 how do I calculate the position of that height reading in the file?

I have read the file in to memory I just need to work out how to select the correct location in the resulting array.

Hope this makes sense.

Thanks for you help

Best Answer

I'm assuming you've loaded it to an array or some similar data structure, correct? A DEM is basically a grid/raster. Your problem now is to map the lon lat coordinates the cells in the grid. As the DEM has a fixed cell size, the precision of your coordinates like say your example

-33.456 152.434

would have to be approximated to match the cells on the raster. Basically, you're doing coordinate conversion. From lon lat to x,y or the cell/pixel addresses.

If you do get tired of trying to do it from scrach, you can try using Sharpmap.

SharpMap is an easy-to-use mapping library for use in web and desktop applications. It provides access to many types of GIS data, enables spatial querying of that data, and renders beautiful maps. The engine is written in C# and based on the .Net 4.0 framework. SharpMap is released under GNU Lesser General Public License.

Happy coding :)