This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Reading Elevation Data Interactively

Extracting DEM Data with demdataui

You can browse many formats of digital elevation map data using the demdataui graphical user interface. The demdataui GUI determines and graphically depicts coverage of ETOPO5, TerrainBase, the satellite bathymetry model (SATBATH), GTOPO30, GLOBE, and DTED data sets on local and network file systems, and can import these files into the workspace.


When it opens, demdataui scans your Mapping Toolbox™ path for candidate data files. On PCs, it also checks the root directories of CD-ROMs and other drives, including mapped network drives. This can cause a delay before the GUI appears.

You can choose to read from any of the data sets demdataui has located. If demdataui does not recognize data you think it should find, check your path and click Help to read about how files are identified.

This exercise illustrates how to use the demdataui interface. You will not necessarily have all the DEM data sets shown in this example. Even if you have only one (the DTED used in the previous exercise, for example), you can still follow the steps to obtain your own results:

  1. Open the demdataui UI. It scans the path for data before it is displayed:


    The Source list in the left pane shows the data sets that were found. The coverage of each data set is indicated by a yellow tint on the map with gray borders around each tile of data. Here, the source is selected to present all DTED files available to a user.

  2. Clicking a different source in the left column updates the coverage display. Here is the coverage area for available GTOPO30 tiles.

  3. Use the map in the UI to specify the location and density of data to extract. To interactively set a region of interest, click in the map to zoom by a factor of two centered on the cursor, or click and drag across the map to define a rectangular region. The size of the matrix of the area currently displayed is printed above the map. To reduce the amount of data, you can continue to zoom in, or or you can raise the Samplefactor slider. A sample factor of 1 reads every point, 2 reads every other point, 3 reads every third point, etc. The matrix size is updated when you move the Samplefactor slider.

    Here is the UI panel after selecting ETOPO30 data and zooming in on the Indian subcontinent.

  4. To see the terrain you have windowed at the sample factor you specified, click the Get button. This causes the GUI map pane to repaint to display the terrain grid with the demcmap colormap. In this example, the data grid contains 580-by-568 data values, as shown below.

  5. If you are not satisfied with the result, click the Clear button to remove all data previously read in via Get and make new selections. You might need to close and reopen demdatui in order to select a new region of interest.

  6. When you are ready to import DEM data to the workspace or save it as a MAT-file, click the Save button. Select a destination and name the output variable or file. You can save to a MAT-file or to a workspace variable. The demdataui function returns one or more matrices as an array of display structures, having one element for each separate get you requested (assuming you did not subsequently Clear). You then use geoshow or mlayers to add the data grids to a map axes.

    The data returned by demdataui contains display structures. You cannot update these to geographic data structures (geostructs) using the updategeostruct function, because they are of type surface, which the updating function does not recognize. However, you can still display them with geoshow, as shown in the next step.

  7. To access the contents of the display structure, use its field names. Here map and maplegend are copied from the structure and used to create a lighted three-dimensional elevation map display using worldmap. (demdata is the default name for the structure, which you can override when you save it.)

    Z =;
    refvec = demdata.maplegend;
    ax = worldmap(Z, refvec);
    geoshow(ax, Z, refvec, 'DisplayType', 'texturemap');
    axis off

Was this topic helpful?