File Exchange

image thumbnail


version (64.8 KB) by Andrew Stevens
Efficient viewing and exploration of large Digital Elevation Models


Updated 07 Apr 2017

From GitHub

View license on GitHub

I regularly have to deal with large (>GB) Digital Elevation Models (DEMs) and have had a difficult time visualizing and exploring these files. DEMVIEWER is designed to dynamically read and display portions data included in a DEM. Currently, DEMs must be imported from an ARC ASCII grid or can be read directly from a Bathymetric Attributed Grid (*.bag) file. More info in help content below:
demViewer is a tool to view and explore large DEMs (Digital Elevation
Models). The display resolution changes dynamically to allow for
efficient viewing of large DEMs. For broad spatial extents, the view
resolution will be low. Increased resolution is achieved by zooming
into smaller areas.

demViewer is a GUI that accepts no inputs. The user must first Open or
Import a data file. Currently, demViewer is only capable of importing
DEMs in ARC Ascii format. During the Import process, demViewer
converts ARC Ascii file to netCDF with three fields (x, y, z) and a few
user-supplied attributes about the DEM. demViewer works with both
projected (cartesian) grids as well as those in spherical coordinates
but has not been tested extensively with grids in spherical
coordinates. NetCDF files previously imported by demViewer can be
displayed directly using the OPEN menu and supports data in Bathymetric
Attributed Grid (.bag) format.

APPEARANCE AND DISPLAY RESOLUTION - The appearance, including colormap,
color limits, and hillshade effect is controlled using the
VIEW-> DEM Options menu. The display resolution can be
adjusted using the EDIT->Set Maximum Pixels to Render option. A larger
number of pixels results in more resolution at a given zoom level,
but slower load time.

Navigation through the DEM is implemented with several self-explanatory
view controls and view mouse inputs, below:

'z' - zoom to a box z
'+' - zoom in
'-' - zoom out
'f' - reset zoom to full extents
'scroll wheel' - pan by pointing the mouse the direction where
you want to pan, then use the scroll wheel in either direction

demViewer also allows the user to draw profiles and plot the elevations
along the specified profiles. The elevations are derived from the
primary (highest) resolution of the DEM regardless of the zoom extent.

EXPORT OPTIONS - THE DEM can be exported into .mat, .xyz, and .png
file formats. The exported data are provided at the current display
resolution and spatial extent.

Cite As

Andrew Stevens (2021). demViewer (, GitHub. Retrieved .

Comments and Ratings (4)

Andrew Stevens

There is a known problem with reading the .bag files that is the result of variable format in the file header. The coordinates of the corners of the matrix are buried in a .xml header that my code is trying to read, but it appears the tag that contains the corner points changes from file to file. I couldn't find documentation on the file format to fix the problem. I am leaving the functionality in the code in the hopes someone is able to solve the problem for me. For now, a suggested work around (though annoying) is to open the .bag file in another software (like ArcGIS) and convert to ArcASCII which can then be imported into this viewer.

Mike Shives

Forgot to mention i'm trying to read .bag file

kiran gk

I installed the app. how to run

Shawn Harrison

This tool is super helpful. It saves me the headache of resampling and reconfiguring axes when viewing huge dems.

I used your arcgridwrite tool to convert many of my existing DEMs to work in this viewer, and they are much more pleasurable to navigate.

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!