Documentation

usgs24kdem

Read USGS 7.5-minute (30-m or 10-m) Digital Elevation Models

Syntax

[lat,lon,Z] = usgs24kdem
[lat,lon,Z] = usgs24kdem(filename)
[lat,lon,Z] = usgs24kdem(filename,samplefactor)
[lat,lon,Z] = usgs24kdem(filename,samplefactor,latlim,lonlim)
[lat,lon,Z] = usgs24kdem(filename,samplefactor,latlim,lonlim,gsize)
[lat, lon, Z, header, profile] = usgs24kdem(...)

Description

[lat,lon,Z] = usgs24kdem reads a USGS 1:24,000 digital elevation map (DEM) file in standard format. The file is selected interactively. The entire file is read and subsampled by a factor of 5. A geolocated data grid is returned with a latitude array, lat, longitude array, lon, and elevation array, Z. Horizontal units are in degrees, vertical units may vary. The 1:24,000 series of DEMs are stored as a grid of elevations spaced either at 10 or 30 meters apart. The number of points in a file will vary with the geographic location.

[lat,lon,Z] = usgs24kdem(filename) reads the USGS DEM specified by filename and returns the result as a geolocated data grid.

[lat,lon,Z] = usgs24kdem(filename,samplefactor) reads a subset of the DEM data from filename. samplefactor is a scalar integer, which when equal to 1 reads the data at its full resolution. When samplefactor is an integer n greater than one, every nth point is read. If samplefactor is omitted or empty, it defaults to 5.

[lat,lon,Z] = usgs24kdem(filename,samplefactor,latlim,lonlim) reads a subset of the elevation data from filename. The limits of the desired data are specified as two-element vectors of latitude, latlim, and longitude, lonlim, in degrees. The elements of latlim and lonlim must be in ascending order. The data may extend somewhat outside the requested area. If limits are omitted, data for the entire area covered by the DEM file is returned.

[lat,lon,Z] = usgs24kdem(filename,samplefactor,latlim,lonlim,gsize) specifies the graticule size in gsize. gsize is a two-element vector specifying the number of rows and columns in the latitude and longitude coordinated grid. If omitted, a graticule the same size as the geolocated data grid is returned. Use empty matrices for latlim and lonlim to specify the coordinated grid size without specifying the geographic limits.

[lat, lon, Z, header, profile] = usgs24kdem(...) also returns the contents of the header and raw profiles of the DEM file. The header structure contains descriptions of the data from the file header. The profile structure is the raw profile data from which the geolocated data grid is constructed.

Background

The U.S. Geological Survey has created a series of digital elevation models based on their paper 1:24,000 scale maps. The grid spacing for these elevations models is either 10 or 30 meters on a Universal Transverse Mercator grid. Each file covers a 7.5 minute quadrangle. The map and data series are available for much of the conterminous United States, Hawaii, and Puerto Rico. The data has been released in a number of formats. This function reads the data in the "standard" file format.

Read USGS 24K DEM file

This example shows how to read a USGS 24K Digital Elevation Model file.

Unzip a USGS 24K DEM file. The toolbox includes a DEM file sanfranciscos.dem.gz .

filenames = gunzip('sanfranciscos.dem.gz', tempdir);
demFilename = filenames{1};

Read every other point of the 1:24,000 DEM file.

[lat,lon,Z,header,profile] = usgs24kdem(demFilename,2);

Delete the temporary gunzipped file.

delete(demFilename);

As no negative elevations exist, move all points at sea level to -1 to color them blue.

Z(Z==0) = -1;

Compute the latitude and longitude limits for the DEM.

latlim = [min(lat(:)) max(lat(:))]
lonlim = [min(lon(:)) max(lon(:))]
latlim =

   37.6249   37.7504


lonlim =

 -122.5008 -122.3740

Display the DEM values.

figure
usamap(latlim, lonlim)
geoshow(lat, lon, Z, 'DisplayType','surface')
demcmap(Z)
daspectm('m',1)

Examine the metadata in the header.

header
header = 

                    Quadranglename: 'SAN FRANCISCO SOUTH, CA  BIG BASIN DEM  '
                       TextualInfo: 'WMC                             CTOG    '
                            Filler: ''
                       ProcessCode: ''
                           Filler2: ''
                SectionalIndicator: ''
                      MCoriginCode: ''
                      DEMlevelCode: 2
              ElevationPatternCode: 'regular'
    PlanimetricReferenceSystemCode: 'UTM'
                              Zone: 10
              ProjectionParameters: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
                   HorizontalUnits: 'meters'
                    ElevationUnits: 'feet'
               NsidesToBoundingBox: 4
                       BoundingBox: [1x8 double]
                  MinMaxElevations: [0 1314]
                     RotationAngle: 0
                      AccuracyCode: 'accuracy information in record C'
                    XYZresolutions: [30 30 1]
                         NrowsCols: [1 371]
                    MaxPcontourInt: NaN
                SourceMaxCintUnits: 'unknown'
                   SmallestPrimary: NaN
                SourceMinCintUnits: 'unknown'
                    DataSourceDate: NaN
                   DataInspRevDate: NaN
                       InspRevFlag: ''
                DataValidationFlag: 'unknown'
                   SuspectVoidFlag: 'unknown'
                     VerticalDatum: 'unknown'
                   HorizontalDatum: 'unknown'
                       DataEdition: NaN
                       PercentVoid: NaN

More About

collapse all

Tips

This function reads USGS DEM files stored in the UTM projection. The function unprojects the grid back to latitude and longitude. Use usgsdem for data stored in geographic grids.

The number of points in a file varies with the geographic location. Unlike the USGS DEM products, which use an equal-angle grid, the UTM projection grid DEMs cannot simply be concatenated to cover larger areas. There can be data gaps between DEMs.

You can obtain the data files from the U.S. Geological Survey and from commercial vendors . Other agencies have made some local area data available online. See Finding Geospatial Data. The DEM files are ASCII files, and can be transferred as text. Line-ending conversion is not necessarily required.

Was this topic helpful?