| Mapping Toolbox™ | ![]() |
[Z,refvec] = gtopo30(tilename)
[Z,refvec] = gtopo30(tilename,samplefactor)
[Z,refvec] = gtopo30(tilename,samplefactor,latlim,lonlim)
[Z,refvec] = gtopo30(dirname,samplefactor,latlim,lonlim)
[Z,refvec] = gtopo30(tilename) reads the GTOPO30 tile specified by tilename and returns the result as a regular data grid. tilename is a string which does not include an extension and indicates a GTOPO30 tile in the current directory 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. 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. Longitude limits range from [-180 180]. 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(dirname,samplefactor,latlim,lonlim) reads and concatenates data from multiple tiles within a GTOPO30 CD-ROM or directory structure. The dirname input is a string with the name of the directory which contains the GTOPO30 tile directories or GTOPO30 tiles. Within the tile directories are the uncompressed data files. The dirname for CD-ROMs distributed by the USGS is the device name of the CD-ROM drive. As in 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 dirname.
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].
When directory dirname contains no GTOPO30 data or tilename identifies a file with a .DEM extension that is not a GTOPO30 file, the function returns a single NaN in Z, a canonical refvec, and issues a warning.
The data and documentation are available over the Internet via http and anonymous ftp, as well as for purchase on CD-ROM.
Note For details on locating map data for download over the Internet, see the following documentation at the MathWorks Web site: http://www.mathworks.com/support/tech-notes/2100/2101.html. |
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.
figure
usamap(Z,refvec);
geoshow(Z,refvec,'DisplayType','surface')
colormap(demcmap(Z))
geoshow(Massachusetts,'DisplayType','polygon',...
'facecolor','none','edgecolor','y')

% Extract every 20th point from a tile. % Provide an empty filename and select the file interactively. [Z,refvec] = gtopo30([],20);
% 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];
gtopo30s(latlim,lonlim)
% Extract every fifth data point for Thailand.
% Specify actual directory or mapped drive if not "F:\'
[Z,refvec] = gtopo30('F:\',5,latlim,lonlim);
worldmap(Z,refvec);
geoshow(Z,refvec,'DisplayType','surface')
colormap(demcmap(Z))

% Extract every 10th point from a column of data 5 degrees around % the prime meridian. The current directory contains GTOPO30 data. [Z,refvec] = gtopo30(pwd,10,[],[-5 5]);
gtopo30s, globedem, dted, satbath, tbase, usgsdem
![]() | gtextm | gtopo30s | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |