[vtkusers] How to import NASA SRTM DEM data into VTK

Elvis Dowson elvis.dowson at mac.com
Mon Oct 13 03:20:51 EDT 2008


Hi,
         Could someone please tell me how I can set vtkImageReader2 to  
read in 1201x1201 array of data elements from the NASA SRTM *.hgt  
file? The file has no header or trailer. All the elevation data is  
stored as 16-bit signed integers.

Here is what I've come up with so far...

vtkImageReader2 reader
   reader SetFileName "/Users/elvis/Repository/Data/NASASRTM/version2/ 
SRTM3/Eurasia/N25E070.hgt"
   reader SetHeaderSize 0
   reader SetDataByteOrderToBigEndian
   reader FileLowerLeftOn
   reader SetDataScalarTypeToInt
   reader SetFileDimensionality 2

So, the first line and first column entry corresponds to array [0][0],  
located on the lower left corner and the corresponding pixel co- 
ordinates will be x=0, y=0, z=the scalar height field value read from  
array location [0][0] say +100 as an example.

similarily,

	the first line and second column entry corresponds to array [0][1],  
x=0, y=1, z= +120
	the first line and last column entry corresponds to array [0][1200],  
x=0, y=1200, z= +110

	the last line and first column entry corresponds to array [1200][0],  
x=1200, y=0, z= +110
	the last line and last column entry corresponds to array [1200] 
[1200], x=1200, y=1200, z= +120

Could someone please help me set this up and display a raster image?

Best regards,

Elvis Dowson

On Oct 13, 2008, at 1:31 AM, Elvis Dowson wrote:

> Hi,
>          I've been doing a bit of reading, so in essence, SRTM data  
> is nothing but raster data, stored using 16-bit signed integer.  
> Depending upon the arc length, you will have either 1201x1201 or  
> 3601x3601 data elements. So, all I have to do is to import each  
> value, taking take to perform byte swapping, since I am using a Mac  
> Book Pro with an Intel processor, and read in two bytes of data,  
> corresponding to a pixel element value, that can later be used to  
> create a raster image of height field data.
>
> I guess the next step is to create a vtkSRTMReader class for VTK,  
> and construct a vtkImageData object as output, which can then be  
> used to render a height field.
>
> Any help or pointers to some examples would be greatly appreciated,  
> since it will help me build this class quickly. :-) !
>
> Best regards,
>
> Elvis Dowson
>
> On Oct 12, 2008, at 11:36 PM, Elvis Dowson wrote:
>>
>> DEM File (.HGT)
>> The DEM is provided as 16-bit signed integer data in a simple  
>> binary raster. There are no header
>> or trailer bytes embedded in the file. The data are stored in row  
>> major order (all the data for row
>> 1, followed by all the data for row 2, etc.).
>> All elevations are in meters referenced to the WGS84/EGM96 geoid as  
>> documented at http://
>> www.NGA.mil/GandG/wgsegm/.
>> Byte order is Motorola ("big-endian") standard with the most  
>> significant byte first. Since they are
>> signed integers elevations can range from -32767 to 32767 meters,  
>> encompassing the range of
>> elevation to be found on the Earth.
>> These data also contain occassional voids from a number of causes  
>> such as shadowing, phase
>> unwrapping anomalies, or other radar-specific causes. Voids are  
>> flagged with the value -32768.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081013/d718a9b1/attachment.htm>


More information about the vtkusers mailing list