Main Content

addCustomTerrain

Add custom terrain data

Since R2021a

Description

example

addCustomTerrain(terrainName,files) adds terrain data specified by files for use with UAV scenarios. Add the terrain to uavScenario objects using the addMesh object function. Custom terrain data is available for current and future sessions of MATLAB® until you call removeCustomTerrain.

addCustomTerrain(___,Name,Value) adds custom terrain data with additional options specified by one or more name-value pairs.

Examples

collapse all

This example shows how to add and remove custom terrain data from a UAV scenario.

Add Custom Terrain Data

Add terrain for a region in Boulder, CO. The DTED file was downloaded from the "SRTM Void Filled" data set available from the U.S. Geological Survey.

dtedfile = "n39_w106_3arc_v2.dt1";
addCustomTerrain("CustomTerrainBoulder",dtedfile)

Create a UAV scenario with the origin set at Boulder, CO. Then, add a terrain mesh.

scenario = uavScenario(ReferenceLocation=[39.5 -105.5 0]);
addMesh(scenario,"terrain",{"CustomTerrainBoulder",[-200 200],[-200 200]},[0.8500 0.3250 0.0980])

Show the scenario.

show3D(scenario);

Figure contains an axes object. The axes object with xlabel East (m), ylabel North (m) contains an object of type patch.

Remove Custom Terrain Data

Use removeCustomTerrain to remove the custom terrain data.

removeCustomTerrain("CustomTerrainBoulder")

Input Arguments

collapse all

User-defined identifier for terrain data, specified as a string scalar or a character vector.

Data Types: char | string

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 files as a string scalar or a character vector.

  • To add custom terrain from multiple DTED files, specify files as 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 FillMissing name-value argument to true.

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 "myFile.dt1".

  • 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 "C:\myfolder\myFile.dt1" or "dataDir\myFile.dt1".

Data Types: char | string | cell

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is 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.

Example: 'FillMissing',true

Attribution of custom terrain data, specified as a character vector or a string scalar. The attribution data is not displayed in UAV scenarios, but can be displayed on geographic plots or the Site Viewer map. By default, the value is empty.

Data Types: char | string

Fill data of missing files with value 0, specified as true or false. Missing file values are required to complete a rectangular geographic region with the input files.

Data Types: logical

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, addCustomTerrain writes extracted terrain files to a temporary folder that it generates using the tempname function.

Data Types: char | string

Tips

  • 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.

Version History

Introduced in R2021a