Nearly all published terrain elevation data is in the form of data grids. Types of Data Grids and Raster Display Functions described basic approaches to rendering surface data grids with Mapping Toolbox™ functions, including viewing surfaces in 3-D axes. The following sections describe some common data formats for terrain data, and how to access and prepare data sets for particular areas of interest.
The Digital Terrain Elevation Data (DTED) Model is a series of gridded elevation models with global coverage at resolutions of 1 kilometer or finer. DTEDs are products of the U. S. National Geospatial Intelligence Agency (NGA), formerly the National Imagery and Mapping Agency (NIMA), and before that, the Defense Mapping Agency (DMA). The data is provided as 1-by-1 degree tiles of elevations on geographic grids with product-dependent grid spacing. In addition to NGA's own DTEDs, terrain data from Shuttle Radar Topography Mission (SRTM), a cooperative project between NASA and NGA, are also available in DTED format, levels 1 and 2 (see below).
The lowest resolution data is the DTED Level 0, with a grid
spacing of 30 arc-seconds, or about 1 kilometer. The DTED files are
binary. The files have filenames with the extension
N is the level of the DTED product. You can
find published specifications for DTED at the NGA web site.
NGA also provides higher resolution terrain data files. DTED Level 1 has a resolution of 3 arc-seconds, or about 100 meters, increasing to 18 arc-seconds near the poles. It was the primary source for the USGS 1:250,000 (1 degree) DEMs. Level 2 DTED files have a minimum resolution of 1 arc-second near the equator, increasing to 6 arc-seconds near the poles. DTED files are available on from several sources on CD-ROM, DVD, and on the Internet.
Note For information on locating map data for download over the Internet, see the following documentation at the MathWorks Web site: Finding Geospatial Data.
The United States Geological Survey (USGS) has prepared terrain data grids for the U.S. suitable for use at scales between 1:24,000 and 1:250,000 and beyond. Some of this data originated from Defense Mapping Agency DTEDs. Specifications and data quality information are available for these digital elevation models (DEMs) and other U.S. National Mapping Program geodata from the USGS. USGS no longer directly distributes 1:24,000 DEMs and other large-scale geodata. U.S. DEM files in SDTS format are available from private vendors, either for a fee or at no charge, depending on the data sets involved.
The largest scale USGS DEMs are partitioned to match the USGS 1:24,000 scale map series. The grid spacing for these elevations models is 30 meters on a Universal Transverse Mercator grid. Each file covers a 7.5-minute quadrangle. (Note, however, that only a subset of paper quadrangle maps are projected with UTM, and that USGS vector geodata products might not use this coordinate system.) The map and data series is available for much of the conterminous United States, Hawaii, and Puerto Rico.
Several Mapping Toolbox functions and a GUI help you identify file names for and manage digital elevation model data for areas of interest. These tools do not retrieve data from the Internet; however, they do locate files that lie on the Mapping Toolbox path and indicate the names of data sets that you can download or order on magnetic media or CD-ROM.
Certain Mapping Toolbox utility functions can describe and import elevation data. The following table describes functions that read in data, determine what file names might exist for a given area, or return metadata for elevation grid files. These files are data products packaged by government agencies; with minor exceptions, the format used for each is unique to that data product, which is why special functions are required to read them and why their filenames and/or footprints can be known a priori.
Function to Read Files
Function to Identify or Summarize Files
U.S. Department of Defense Digital Terrain Elevation Data
USGS 1-degree (3-arc-second resolution) digital elevation models
USGS 1:24K (30-meter resolution) digital elevation models
ETOPO1c, ETOPO2v2c, ETOPO2–2001, and ETOPO5
Earth Topography – 1-minute (ETOPO1c), 2-minute (ETOPO2v2c and ETOPO2–2001), and 5-minute (ETOPO5)
Tiles of 30-arc-second global elevation models
Global 2-minute (4 km) satellite topography and bathymetry data
Digital elevation models in U.S. SDTS format
TerrainBase topography and bathymetry binary and ASCII grid files
Note that the names of functions that identify file names are
those of their respective file-reading functions appended with
These functions determine file names for areas of interest, and have
calling arguments of the form (
with which you indicate the latitude and longitude limits for an area
of interest, and all return a list of filenames that provide the elevations
required. The southernmost latitude and the western-most longitude
must be the first numbers in
Suppose you want to obtain elevation data for the area around Cape Cod, Massachusetts. You define your area of interest to extend from 41.1ºN to 43.9ºN latitude and from 71.9ºW to 69.1ºW longitude.
To determine which DTED files you need,
dteds function, which returns a cell
array of strings:
dteds([41.1 43.9],[-71.9 -69.1]) ans = '\DTED\W072\N41.dt0' '\DTED\W071\N41.dt0' '\DTED\W070\N41.dt0' '\DTED\W072\N42.dt0' '\DTED\W071\N42.dt0' '\DTED\W070\N42.dt0' '\DTED\W072\N43.dt0' '\DTED\W071\N43.dt0' '\DTED\W070\N43.dt0'
Note three important considerations about using DTED files:
DTED filenames reflect latitudes only and thus do
not uniquely specify a data set; they must be organized within directories
that specify longitudes. When you download level 0 DTEDs, the
and its subfolders are transferred as a compressed archive that you
must decompress before using.
Some files that the
identifies do not exist, either because they completely cover water
bodies or have never been created or released by NGA. The
that reads the DTEDs handles missing cells appropriately.
NGA might or might not continue to make DTED data sets available to the general public online. For information on availability of terrain data from NGA and other sources, see Finding Geospatial Data.
To determine the USGS DEM files you
need, use the
usgsdems([41.1 43.9],[-71.9 -69.1]) ans = 'portland-w' 'portland-e' 'bath-w' 'boston-w' 'boston-e' 'providence-w' 'providence-e' 'chatham-w'
Note that, in contrast to the
you executed above, there are eight rather than nine files listed
to cover the 3-by-3-degree region of interest. The cell that consists
entirely of ocean has no name and is thus omitted from the output
To determine the GTOPO30 files you
need, use the
gtopo30s([41.1 43.9],[-71.9 -69.1]) ans = 'w100n90'
The DTED, GTOPO30, and small-scale (low-resolution) USGS DEM
grids are in latitude and longitude. Large-scale (24K) USGS DEMs grids
are in UTM coordinates. The
In this exercise, you render DTED level 0 data for a portion of Cape Cod. The 1°-by-1° file can be downloaded from NGA or purchased on CD-ROM. You read and display the elevation data at full resolution as a lighted surface to show both large- and small-scale variations in the data.
Define the area of interest and determine the file to be obtained:
latlim = [ 41.20 41.95]; lonlim = [-70.95 -70.10];
To determine which DTED files you need,
dteds function, which returns a cell array
dteds(latlim, lonlim) ans = 'dted\w071\n41.dt0'
In this example, only one DTED file is needed, so the answer
is a single string. For more information on the
see Using dteds, usgsdems, and gtopo30s to Identify DEM Files).
Unless you have a CD-ROM containing this file, download it from the source indicated in the following tech note:
The original data comes as a compressed tar or zip archive that you must expand before using.
to create a terrain grid and a referencing vector in the workspace
at full resolution. If more than one DTED file named n41.dt0 exists
on the path, your working folder must be
order to be sure that
dted finds the correct file.
If the file is not on the path, you are prompted to navigate to the
samplefactor = 1; [capeterrain, caperef] = dted('n41.dt0', ... samplefactor, latlim, lonlim);
Because DTED files contain no bathymetric depths, decrease elevations of zero slightly to render them with blue when the colormap is reset:
capeterrain(capeterrain == 0) = -1;
construct an empty map of axes for the region defined by the latitude
and longitude limits:
figure; ax = usamap(latlim,lonlim);
Read data for the region defined by
the latitude and longitude limits from the
capecoast = shaperead('usastatehi',... 'UseGeoCoords', true,... 'BoundingBox', [lonlim' latlim']);
Display coastlines on the map axes
that was created with
geoshow(ax, capecoast, 'FaceColor', 'none');
At this point the map looks like this:
Render the elevations, and set the colormap accordingly:
meshm(capeterrain, caperef, size(capeterrain), capeterrain); demcmap(capeterrain)
The resulting map, shown below, is a window on Cape Cod, and illustrates the relative coarseness of DTED level 0 data.
When your region of interest extends across more than one DTED
dted function concatenates the tiles
into a single matrix, which can be at full resolution or a sample
of every nth row and column. You can specify
a single DTED file, a folder containing several files (for different
latitudes along a constant longitude), or a higher level folder containing
subfolders with files for several longitude bands.
To follow this exercise, you need to acquire the necessary DTED files from the Internet, as described in Finding Geospatial Data, or from a CD-ROM. This yields a set of directories that contain the following files:
/dted /w070 n41.avg n41.dt0 n41.max n41.min n43.avg n43.dt0 n43.max n43.min /w071 n41.avg n41.dt0 n41.max n41.min n42.avg n42.dt0 n42.max n42.min n43.avg n43.dt0 n43.max n43.min /w072 n41.avg n41.dt0 n41.max n41.min n42.avg n42.dt0 n42.max n42.min n43.avg n43.dt0 n43.max n43.min
Change your working folder to the folder
that includes the top-level DTED folder (which is always named
specifying that folder as the first argument:
latlim = [ 41.1 43.9]; lonlim = [-71.9 -69.1]; samplefactor = 5; [capetopo,caperef] = dted(pwd, samplefactor, latlim, lonlim);
The sample factor value of 5 specifies that only every fifth
data cell, in both latitude and longitude, will be read from the original
DTED file. You can choose a larger value to save memory and speed
processing and display, at the expense of resolution and accuracy.
The size of your elevation array (
be inversely proportional to the square of the sample factor.
Note You can specify a DTED filename rather than a folder name if you are accessing only one DTED file. If the file cannot be found, a file dialog is presented for you to navigate to the file you want. See the example Mapping a Single DTED File with the DTED Function.
As DTEDs contain no bathymetric depths, recode all zero elevations to -1, to enable water areas to be rendered properly:
Obtain the elevation grid's latitude and longitude limits; use them to draw an outline map of the area to orient the viewer:
[latlim,lonlim] = limitm(capetopo,caperef); figure; ax = usamap(latlim,lonlim); capecoast = shaperead('usastatehi',... 'UseGeoCoords', true,... 'BoundingBox', [lonlim' latlim']); geoshow(ax,capecoast,'FaceColor','None');
The map now looks like this.
Render the elevation grid with
and then recolor the map with
demcmap to display
hypsometric colors (elevation tints):
meshm(capetopo, caperef, size(capetopo), capetopo); demcmap(capetopo)
Here is the map; note the missing tile to the right where no DTED data exists.