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.


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


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


[Z,refvec] = gtopo30(tilename) reads the GTOPO30 tile specified by tilename and returns the result as a regular data grid. tilename is a 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 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].

For details on locating GTOPO30 data for download over the Internet, see Finding Geospatial Data.


Example 1

Extract and display full resolution data for the state of Massachusetts:

% Read the stateline 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 stateline boundary.

Example 2

% Extract every 20th point from a tile. 
% Provide an empty filename and select the file interactively. 
[Z,refvec] = gtopo30([],20);

Example 3

% Extract data for Thailand, an area which straddles two tiles. 
% The data is on CD number 3 distributed by the USGS.
% The CD-device is 'F:\'
latlim = [5.22 20.90]; 
lonlim = [96.72 106.38];
% Extract every fifth data point for Thailand.
% Specify actual folder or mapped drive if not "F:\'
[Z,refvec] = gtopo30('F:\',5,latlim,lonlim);

Example 4

% Extract every 10th point from a column of data 5 degrees around
% the prime meridian. The current folder contains GTOPO30 data.
[Z,refvec] = gtopo30(pwd,10,[],[-5 5]);

Introduced before R2006a

Was this topic helpful?