Main Content

gtopo30

(Removed) Read 30-arc-second global digital elevation data (GTOPO30)

The gtopo30 function has been removed. Use the readgeoraster function instead. For more information, see Version History.

Syntax

[Z,refvec] = gtopo30(tilename)
[Z,refvec] = gtopo30(tilename,samplefactor)
[Z,refvec] = gtopo30(tilename,samplefactor,latlim,lonlim)
[Z,refvec] = gtopo30(foldername, ...)

Description

[Z,refvec] = gtopo30(tilename) reads the GTOPO30 tile specified by tilename and returns the result as a regular data grid. tilename is a string scalar or character vector which does not include an extension and indicates a GTOPO30 tile in the current folder or on the MATLAB® path. If tilename is empty or omitted, a file browser will open for interactive selection of the GTOPO30 header file. The data is returned at full resolution with the latitude and longitude limits determined from the GTOPO30 tile. The data grid, Z, is returned as an array of elevations. Elevations are given in meters above mean sea level using WGS84 as a horizontal datum. refvec is the associated referencing vector.

[Z,refvec] = gtopo30(tilename,samplefactor) reads a subset of the elevation data from tilename. 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 1.

[Z,refvec] = gtopo30(tilename,samplefactor,latlim,lonlim) reads a subset of the elevation data from tilename using the latitude and longitude limits latlim and lonlim specified in degrees. latlim is a two-element vector of the form:

[southern_limit northern_limit]

Likewise, lonlim has the form:

[western_limit eastern_limit]

If latlim and lonlim are omitted, the coordinate limits are determined from the file. The latitude and longitude limits are snapped outward to define the smallest possible rectangular grid of GTOPO30 cells that fully encloses the area defined by the input limits. Any cells in this grid that fall outside the extent of the tile are filled with NaN.

[Z,refvec] = gtopo30(foldername, ...) is similar to the syntaxes above except that GTOPO30 data are read and concatenated from multiple tiles within a GTOPO30 CD-ROM or folder structure. The foldername input is a string scalar or character vector with the name of the folder which contains the GTOPO30 tile folders or GTOPO30 tiles. Within the tile folders are the uncompressed data files. The foldername for CD-ROMs distributed by the USGS is the device name of the CD-ROM drive. As with the case with a single tile, any cells in the grid specified by latlim and lonlim are NaN filled if they are not covered by a tile within foldername. samplefactor if omitted or empty defaults to 1. latlim if omitted or empty defaults to [-90 90]. lonlim if omitted or empty defaults to [-180 180].

Examples

collapse all

To run this example, you must download the GTOPO30 data set.

Extract and display full resolution data for the state of Massachusetts. Read the state line polygon boundary and calculate boundary limits.

Massachusetts = shaperead('usastatehi','UseGeoCoords',true, ...
  'Selector',{@(name) strcmpi(name,'Massachusetts'),'Name'});
latlim = [min(Massachusetts.Lat(:)) max(Massachusetts.Lat(:))];
lonlim = [min(Massachusetts.Lon(:)) max(Massachusetts.Lon(:))];

Read the GTOPO30 data at full resolution.

[Z,refvec] = gtopo30('W100N90',1,latlim,lonlim);

Display the data grid and overlay the state line boundary.

figure
ax = usamap(Z,refvec);
ax.SortMethod = 'ChildOrder';
geoshow(Z,refvec,'DisplayType','surface')
demcmap(Z)
geoshow(Massachusetts,'DisplayType','polygon',...
  'facecolor','none','edgecolor','y')

Topographic map showing the state boundary of Massachusetts

Version History

Introduced before R2006a

expand all