DTED is a military specification for storing terrain elevation data used by the U.S. Department of Defense and Geographic Information Systems. This implementation provides functionality to read and process DTED files through GDAL.
DTED comes in three resolution levels:
- Level 0: Lowest resolution (~1km)
- Level 1: Medium resolution (~100m)
- Level 2: Highest resolution (~30m)
DTED Grid Example (3601x3601 pixels for Level 2):
[1000m][1200m][900m]...
[800m] [750m] [600m]...
[500m] [450m] [400m]...
How This Code Works Core Features Opens DTED files using GDAL library Reads elevation data row by row Finds highest elevation point Converts grid coordinates to latitude/longitude Dependencies GDAL (Geospatial Data Abstraction Library) C++ compiler Installation
brew install gdal
g++ -o find_highest_point find_highest_point.cpp $(gdal-config --cflags) $(gdal-config --libs)
./find_highest_point path/to/file.dt2
- Handles file reading
- Tracks maximum elevation
- Converts coordinates
- Reads elevation data in 16-bit integers
- Scans entire grid for highest point
- Uses geotransform for coordinate conversion
Highest point:
Elevation: 2500 meters
Location: 35.6789°N, 138.7654°E
- DTED-2 (.dt2) files: 3601x3601 grid
- Each pixel represents ~30m on Earth's surface
- Elevation precision: 1 meter
- Efficient row-by-row reading
- Only one scanline in memory at a time
- 16-bit integer storage per elevation point
[x,y] grid coordinates → [latitude,longitude] using:
- Origin point (top-left)
- Pixel spacing
- Rotation parameters
Main class handling DTED file operations:
class DTEDDataset {
char *pszFilename;
DTED *psDTED;
bool bVerifyChecksum;
// ... other members
};Class for finding elevation extremes:
class DTEDHighPoint {
double maxElevation;
double latitude;
double longitude;
};- Reading DTED files
- Accessing elevation data
- Metadata handling
- Coordinate transformations
DTED_VerticalAccuracy
DTED_HorizontalAccuracy
DTED_VerticalDatum
DTED_HorizontalDatum
GDAL_DTED_SINGLE_BLOCK=TRUE/FALSE // Read mode
DTED_VERIFY_CHECKSUM=YES/NO // Data validation
// Initialize DTED file handler
DTEDHighPoint finder;
// Process DTED file
if (finder.findHighestPoint("elevation.dt1")) {
double elevation = finder.getMaxElevation();
double lat = finder.getLatitude();
double lon = finder.getLongitude();
}- Origin coordinates
- Resolution data
- Security classifications
- Reference system info
- Data compilation details
- Column-major storage
- North-south profile alignment
- Elevation values in meters
- Special handling for no-data values
- GDAL core library
- C++ Standard Library
- Common Portability Library (CPL)
For detailed API documentation and implementation specifics, see:
- GDAL DTED Documentation
- DTED Format Specification
- Default horizontal datum: WGS84
- Elevation referenced to mean sea level
- Preserves security codes and partial cell indicators
- Supports both reading and limited writing capabilities
cmake -DGDAL_ENABLE_DRIVER_DTED=ON ..
makeFor development and testing, refer to CMakeLists.txt.