Main Content


(To be removed) Read U.S. Department of Defense Digital Terrain Elevation Data (DTED)

dted will be removed in a future release. Use readgeoraster instead. For more information, see Version History.


[Z, refvec] = dted
[Z, refvec] = dted(filename)
[Z, refvec] = dted(filename, samplefactor)
[Z, refvec] = dted(filename, samplefactor, latlim, lonlim)
[Z, refvec] = dted(foldername, samplefactor, latlim, lonlim)
[Z, refvec, UHL, DSI, ACC] = dted(...)


[Z, refvec] = dted returns all of the elevation data in a DTED file as a regular data grid, Z, with elevations in meters. The file is selected interactively. This function reads the DTED elevation files, which generally have file names ending in .dtN, where N is 0,1,2,3,... refvec is the associated three-element referencing vector that geolocates Z.

[Z, refvec] = dted(filename) returns all of the elevation data in the specified DTED file. The file must be found on the MATLAB® path. If not found, the file may be selected interactively.

[Z, refvec] = dted(filename, samplefactor) subsamples data from the specified DTED file. samplefactor is a scalar integer. When samplefactor is 1 (the default), DTED reads the data at its full resolution. When samplefactor is an integer n greater than one, every nth point is read.

[Z, refvec] = dted(filename, samplefactor, latlim, lonlim) reads the data for the part of the DTED file within the latitude and longitude limits. The limits must be two-element vectors in units of degrees.

[Z, refvec] = dted(foldername, samplefactor, latlim, lonlim) reads and concatenates data from multiple files within a DTED CD-ROM or folder structure. The foldername input is a string scalar or character vector with the name of a folder containing the DTED folder. Within the DTED folder are subfolders for each degree of longitude, each of which contain files for each degree of latitude. For DTED CD-ROMs, foldername is the device name of the CD-ROM drive.

[Z, refvec, UHL, DSI, ACC] = dted(...) returns structures containing the DTED User Header Label (UHL), Data Set Identification (DSI) and Accuracy metadata records.


The U. S. Department of Defense, through the National Geospatial Intelligence Agency, produces several kinds of digital cartographic data. One is digital elevation data, in a series called DTED, for Defense Digital Terrain Elevation Data. The data is available as 1-by-1 degree quadrangles at horizontal resolutions ranging from about 1 kilometer to 1 meter. The lowest resolution data is available to the public. Certain higher resolution data is restricted to the U.S. Department of Defense and its contractors.

DTED Level 0 files have 121-by-121 points. DTED Level 1 files have 1201-by-1201. The edges of adjacent tiles have redundant records. Maps extend a half a cell outside the requested map limits. The 1 kilometer data and some higher-resolution data is available online, as are product specifications and documentation. DTED files are binary. No line ending conversion or byte-swapping is required when downloading a DTED file.


collapse all

Read and display DTED data for an area around South Boulder Peak in Colorado.

First, import the elevation data. Replace unused output arguments with a tilde character (~). Associate the elevation data with geographic locations by creating a geographic postings reference object. To create a reference object, specify the latitude limits, longitude limits, and size of the elevation data grid.

[Z,~] = dted('n39_w106_3arc_v2.dt1');

latlim = [39 40];
lonlim = [-106 -105];
R = georefpostings(latlim,lonlim,size(Z));

Create a map, then plot the data using geoshow. Display a colormap appropriate for elevation data using demcmap.


Elevation map of an area surrounding South Boulder Peak

The DTED file used in this example is courtesy of the US Geological Survey.


Latitude-Dependent Sampling

In DTED files north of 50° North and south of 50° South, where the meridians have converged significantly relative to the equator, the longitude sampling interval is reduced to half of the latitude sampling interval. In order to retain square output cells, this function reduces the latitude sampling to match the longitude sampling. For example, it will return a 121-by-121 elevation grid for a DTED file covering from 49 to 50 degrees north, but a 61-by-61 grid for a file covering from 50 to 51 degrees north. When you supply a folder name instead of a file name, and latlim spans either 50° North or 50° South, an error results.

Snapping Latitude and Longitude Limits

If you call dted specifying arbitrary latitude-longitude limits for a region of interest, the grid and referencing vector returned will not exactly honor the limits you specified unless they fall precisely on grid cell boundaries. Because grid cells are discrete and cannot be arbitrarily divided, the data grid returned will include all areas between your latitude-longitude limits and the next row or column of cells, potentially in all four directions.

Data Sources and Information

DTED files contain digital elevation maps covering 1-by-1-degree quadrangles at horizontal resolutions ranging from about 1 kilometer to 1 meter. For details on locating DTED for download over the Internet, see Find Geospatial Raster Data.

Null Data Values

Some DTED Level 1 and higher data tiles contain null data cells, coded with value -32767. When encountered, these null data values are converted to NaN.

Nonconforming Data Encoding

DTED files from some sources may depart from the specification by using two's complement encoding for binary elevation files instead of “sign-bit” encoding. This difference affects the decoding of negative values, and incorrect decoding usually leads to nonsensical elevations.

Thus, if the DTED function determines that all the (nonnull) negative values in a file would otherwise be less than -12,000 meters, it issues a warning and assumes two's complement encoding.

Version History

Introduced before R2006a

expand all

R2024a: Warns

Raster reading functions that return referencing vectors issue a warning that they will be removed in a future release, including dted. Instead, use readgeoraster, which returns a geographic postings reference object. Reference objects have several advantages over referencing vectors.

  • Unlike referencing vectors, reference objects have properties that document the size of the associated raster, its geographic limits, and the direction of its rows and columns. For examples of reference object properties, see GeographicPostingsReference.

  • You can manipulate the limits of rasters associated with geographic reference objects using the geocrop function.

  • You can manipulate the size and resolution of rasters associated with geographic reference objects using the georesize function.

  • Most functions that accept referencing vectors as input also accept reference objects.

Get metadata about DTED files by accessing properties of the reference object or by using the georasterinfo function.

This table shows some typical usages of dted and how to update your code to use readgeoraster and georasterinfo. The readgeoraster function requires you to specify a file extension. For example, use [Z,R] = readgeoraster('n39_w106_3arc_v2.dt1').

Will Be RemovedRecommended
[Z,refvec] = dted(filename);
[Z,R] = readgeoraster(filename);
[Z,refvec] = dted(filename,samplefactor);
[Z,R] = readgeoraster(filename);
[Z,R] = georesize(Z,R,1/samplefactor);
[Z,refvec] = dted(filename,samplefactor,latlim,lonlim);
[Z,R] = readgeoraster(filename);
[Z,R] = geocrop(Z,R,latlim,lonlim);
[Z,R] = georesize(Z,R,1/samplefactor);
[Z,refvec,UHL,DSI,ACC] = dted(filename);
[Z,R] = readgeoraster(filename);
info = georasterinfo(filename);
meta = info.Metadata;

The readgeoraster function returns data using the native data type embedded in the file. Return a different data type by specifying the 'OutputType' name-value pair. For example, use [Z,R] = readgeoraster(filename,'OutputType','double').

The readgeoraster function does not automatically replace missing data with NaN values. If your data set uses large negative numbers to indicate missing data, replace them with NaN values using the standardizeMissing function.

[Z,R] = readgeoraster('MtWashington-ft.grd');
info = georasterinfo('MtWashington-ft.grd');
m = info.MissingDataIndicator;
Z = standardizeMissing(Z,m);

Reading and merging multiple DTED files from a folder using the readgeoraster function is not supported. To read and merge multiple DTED files from a folder:

  1. Find the standard names of the DTED files required to cover a region by using the dteds function.

  2. Read the individual files by using the readgeoraster function

  3. Starting in R2024a, merge the files by using the mergetiles function. Before R2024a, merge the files by using the workflow in Merge Spatially Referenced Raster Tiles.

Alternatively, you can read and merge multiple DTED files from a folder by using a custom datastore. For more information about using custom datastores to read and merge multiple tiles, see Merge Multiple Raster Tiles Using Datastore.