Add custom terrain data
adds terrain data specified by
files for use with geographic
plotting functions such as
geoglobe. The terrain is named
terrainName, and you
can specify it by this name when calling a plotting function. Custom terrain data is
available for current and future sessions of MATLAB®, until you call
adds custom terrain data with additional options specified by one or more name-value
Display Custom Terrain Using Geographic Globe
Display a line from the surface of Gross Reservoir to a point above South Boulder Peak using custom terrain.
First, add terrain for an area around South Boulder Peak by calling
addCustomTerrain and specifying a DTED file. The DTED file is from the SRTM Void Filled data set, available from the US Geological Survey. Name the terrain
Create a geographic globe. Specify the terrain by name, using the
"Terrain" argument of the
geoglobe function. Then, plot the line. Tilt the view by holding Ctrl and dragging.
uif = uifigure; g = geoglobe(uif,"Terrain","southboulderpeak"); lat = [39.95384 39.95]; lon = [-105.29916 -105.3608]; hTerrain = [10 0]; geoplot3(g,lat,lon,hTerrain,"y","HeightReference","Terrain","LineWidth",3)
Close the geographic globe and remove the custom terrain.
terrainName — User-defined identifier for terrain data
string scalar | character vector
User-defined identifier for terrain data, specified as a string scalar or a character vector.
files — Names of DTED files to read
string scalar | character vector | string vector | cell array of character vectors
Names of DTED files to read, specified as a string scalar, a character vector, a string vector, or a cell array of character vectors.
To add custom terrain from one DTED file, specify
filesas a string scalar or a character vector.
To add custom terrain from multiple DTED files, specify
filesas a string vector or a cell array of character vectors. If you specify multiple files that do not cover a complete rectangular geographic region, you must set the
FillMissingname-value argument to
The form of each element of
files depends on the
location of the file.
If the file is in your current folder or in a folder on the MATLAB path, then specify the name of the file, such as
If the file is not in the current folder or in a folder on the MATLAB path, then specify the full or relative path name, such as
Specify optional pairs of arguments as
the argument name and
Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
Attribution — Attribution of custom terrain data
character vector | string scalar
Attribution of custom terrain data, specified as a character vector or a string scalar. Attributions display on geographic plots that use the custom terrain. By default, the attribution is empty.
FillMissing — Fill data of missing files with value 0
false (default) |
Fill data of missing files with value 0, specified as
false. Missing file
values are required to complete a rectangular geographic region with the
WriteLocation — Name of folder to write extracted terrain files to
character vector | string scalar
Name of folder to write extracted terrain files to, specified as a
character vector or a string scalar. The folder must exist and have
write permissions. By default,
writes extracted terrain files to a temporary folder that it generates
To deploy an application with custom terrain using MATLAB Compiler™, call
addCustomTerrainin the application and include the DTED files in the deployed application package.
You can find and download DTED files by using EarthExplorer, a data portal provided by the US Geological Survey (USGS). From the list of data sets, search for DTED files by selecting Digital Elevation, SRTM, and then SRTM 1 Arc-Second Global and SRTM Void Filled.
Introduced in R2020a