DATA STRUCTURE FOR SOFTWRIGHT 3- AND 30-SECOND ELEVATION FILES
Restrictions
This document describes the data file structure used with SoftWright's terrain point elevation data bases. These data bases are provided under a licensing agreement between the user and SoftWright, and this document is included in that licensing agreement. SoftWright's data file structure is proprietary and copyrighted. The information contained in this specification sheet is intended only for licensed users of SoftWright's data bases. This information may not be divulged in any form to any other person without prior written authorization from SoftWright.
Introduction
The terrain point elevation data bases are provided by SoftWright primarily for use with the Terrain Analysis Package (TAP)Ô software system. However, the data structure is also designed for convenient access by other software, such as user-written retrieval programs.
Data Bases
Two data bases are currently available from SoftWright: a three arc-second data base from USGS Digital Elevation Models (DEM) and a 30 arc-second from the National Geophysical Data Center (NGDC) 30 second point elevation data. The two data bases have similar structure so common software can be written for use with both with only minimal changes in record length, elevation units, etc.
In both data bases elevation values are stored in files covering one degree of latitude by one degree of longitude. Each one degree by one degree area is referred to as a "block."
File Names
File names used with SoftWright terrain elevation data bases indicate three items about the data:
1. The first character indicates the data base used. Data file names in the 30-second data base begin with "A" and file names in the 3-second data base begin with "B".
2. The next five characters indicate which block of data is contained in the file. The three-digit (including a leading zero if needed) longitude and the two-digit latitude of the southeast corner of the block are used in the file name, e.g., 09939 indicates that the south east corner of the block is west longitude 99 degrees, north latitude 39 degrees.
3. The final character indicates the segment of the degree block in the file. Data blocks in the 3-second data base are segmented when distributed on floppy disks, since each data block requires approximately 2.9Mb. The blocks are segmented into eight (8) files, with the final character A-H in the file name. (See Appendix B in the TAP user's manual for more information concerning segmented files.) Data files for 3-second data distributed on CD-ROM are not segmented and use the final character "_" (underscore). For 30-second data, the character is always "A" since all 30-second files are complete blocks (i.e., blocks are not segmented).
For example, the file name B10439_.DTA is a 3-second data file with the southeast corner at longitude 104 and latitude 39, and the file is a composite (non-segmented) file. (The DOS file extent for all files is DTA.)
Directory Structure (CD ROM)
Elevation data files distributed on CD ROM disks are arranged in a tree directory structure to improve performance on slower CD ROM drives.
Each CD ROM disk has three (3) entries in the root directory. The only file in the root directory is named SWCDROM.NUM and contains an ASCII numeric character indicating the CD ROM number 1 through 6.
The other two entries in the CD ROM root are subdirectories named "A" (for 30-second data) and "B" (for 3-second data). Each of these directories contains a number of other subdirectories named with two-digit numeric characters. The two-digit subdirectory name corresponds to the latitude of the data files in that subdirectory. For example, the complete path of the file in the above example would be
L:\B\39\B10439_.DTA
File Structure
Each data block is considered an array of point elevation values, beginning at the lower right (southeast) corner of the block.
Successive values in the file represent elevations along the same longitude and increasing in latitude by the data base resolution (3- or 30-seconds between successive points). When the northern edge of the block is reached (59 minutes, 30 seconds for the 30-second data; 59 minutes, 57 seconds for the 3-second data) the next point increases in longitude (by either 3- or 30-seconds) and the latitude resets to the "bottom" (i.e., starts back at latitude 0 minutes, 0 seconds).
No other position information (longitude and latitude) is saved for the elevation values in the file. Only the elevation value is stored, since the location of each point is completely defined by its location in the file.
The first record in each file (record 0) is a header record containing information used by some TAP programs. Actual elevation data begins with the second record in the file.
Record Structure
Each file consists of fixed length records of two-byte integers in unformatted binary form. In the 30-second data files, each two-byte integer represents the elevation of the point in feet above mean sea level (AMSL). In the 3-second data files, the elevation values are in meters AMSL.
The record lengths for the two data bases are different:
The records in the 30-second data files are 242 bytes (120 two-byte elevation values in each record; the last two bytes of each record are not an elevation value and should be ignored). Each file contains 122 records (0-121).
The records in the 3-second data files are 2400 bytes (1200 two-byte elevation values in each record. For segmented files distributed on floppy disk (eight files per degree block) each file contains 151 records (0-150). For composite (non-segmented) files distributed on CD-ROM, each file contains 1201 records (0-1200).
Finding Elevation Values
The elevation of a specific point in the data base (given the desired longitude and latitude) can be found as follows:
1. Determine the file containing the point. The file name is composed of the data base prefix (A or B), the longitude and latitude degrees, and the file suffix (A-H or "_").
For example, the elevation of the point at latitude 39:40:33, longitude 104:33:30 is in the block 10439 (longitude, latitude). Assuming you are using the 3-second data base, the prefix is B. If a composite file on a CD-ROM is used, the suffix is "_" so the resulting file name would be:
B10439_.DTA
If segmented files (distributed on floppy disks) are used, the suffix (based on the longitude, see the TAP user's manual, Appendix B) would be "E":
B10439E.DTA
2. Determine the record in the file. The record number in the file is a function of the longitude, since each record can be considered a vertical "strip" of constant longitude. The physical record number in a composite file is determined by the equation:
2 + (LONm x 60/R) + (LONs/R)
where: LONm is the minutes of the longitude of the point
LONs is the seconds of the longitude of the point
R is the longitudinal resolution of the data base (usually 3 or 30)
(Remember that the first physical record in the file is record #0 (zero), and the first data record, record #1 is the second physical record and this is the value computed above.)
In the example started above (longitude 104:33:30, latitude 39:40:33 in the 3-second data base), this takes the value:
2 + (33 x 60 / 3) + (30 / 3) = 672
The elevation of the example point will be found in the 672nd physical record of the file.
If segmented files are used, the computed record number must be reduced to account for the records in other segment files. In this example, since the point is in file "E" there are four other files (A through D), each with 150 data records. Therefore, the record number in segmented file B10439E.DTA would be
672 - (4 x 150) = 72
In other words, when using segmented files, records 1 through 150 would be in file "A", records 151 through 300 would be in file "B", records 301 through 450 in file "C" and records 451 through 600 in file "D". The desired point would be in the 72nd physical record of file "E".
3. Determine the field location in the record. Each elevation value is represented by a two-byte field, starting with field #1 in each record. Records in the 3-second data base contain 1200 fields per record. Records in the 30-second data base contain 121 fields per record. The fields represent ascending latitude values along the line of constant longitude represented by the record. The field number of the elevation value is determined by the equation:
1 + (LATm x 60/R) + (LATs/R)
where: LATm is the minutes of the latitude of the point
LATs is the seconds of the latitude of the point
R is the latitudinal resolution of the data base (3 or 30)
In the example started above (longitude 104:33:30, latitude 39:40:33 in the 3-second data base), this takes the value:
1 + (40 x 60 / 3) + (33 / 3) = 812
Thus the elevation of the point in the example is the 812th 2-byte value in the record.