Main Content

globedem

(To be removed) Read Global Land One-km Base Elevation (GLOBE) data

globedem will be removed in a future release. Use readgeoraster instead. For more information, see Compatibility Considerations.

Syntax

[Z,refvec] = globedem(filename,scalefactor)
[Z,refvec] = globedem(filename,scalefactor,latlim,lonlim)
[Z,refvec] = globedem(foldername,scalefactor,latlim,lonlim)

Description

[Z,refvec] = globedem(filename,scalefactor) reads the GLOBE DEM files and returns the result as a regular data grid. The filename is given as a string scalar or character vector that does not include an extension. globedem first reads the Esri® header file found in the subfolder '/esri/hdr/' and then the binary data file name. If the files are not found on the MATLAB® path, they can be selected interactively. scalefactor is an integer that when equal to 1 gives the data at its full resolution. When scalefactor is an integer n larger than 1, every nth point is returned. The map data is returned as an array of elevations and associated three-element referencing vector. Elevations are given in meters above mean sea level, using WGS 84 as a horizontal datum.

[Z,refvec] = globedem(filename,scalefactor,latlim,lonlim) allows a subset of the map data to be read. The limits of the desired data are specified as vectors of latitude and longitude in degrees. The elements of latlim and lonlim must be in ascending order.

[Z,refvec] = globedem(foldername,scalefactor,latlim,lonlim) reads and concatenates data from multiple files within a GLOBE folder tree. The foldername input is a string scalar or character vector with the name of the folder that contains both the uncompressed data files and the Esri header files.

Background

GLOBE, the Global Land One-km Base Elevation data, was compiled by the National Geophysical Data Center from more than 10 different sources of gridded elevation data. GLOBE can be considered a higher resolution successor to TerrainBase. The data set consists of 16 tiles, each covering 50 by 90 degrees. Tiles require as much as 60 MB of storage. Uncompressed tiles take between 100 and 130 MB.

Examples

Determine the file that contains the area around Cape Cod. (This example assumes you have already downloaded some GLOBE data tiles.)

latlim = [41 42.5]; lonlim = [-73 -69.9];
globedems(latlim,lonlim)

ans = 
    'f10g'

Extract every 20th point from the tile covering the northeastern United States and eastern Canada. If you specify an empty file name (''), globedem presents a file browser that you use to first select the header file and then select the data file interactively.

[Z,refvec] = globedem('',20);
size(Z)

ans =
   300   540

Extract a subset of the data for Massachusetts at the full resolution.

latlim = [41 42.5]; lonlim = [-73 -69.9];
[Z,refvec] = globedem('f10g',1,latlim,lonlim);
size(Z)

ans =
   181 373

Replace the NaNs in the ocean with -1 to color them blue.

Z(isnan(Z)) = -1;

Extract some data for southern Louisiana in an area that straddles two tiles. Provide the name of the folder containing the data files, and let globedem determine which files are required, read from the files, and concatenate the data into a single regular data grid.

latlim =[28.61 31.31]; lonlim = [-91.24 -88.62];
globedems(latlim,lonlim)

ans = 
    'e10g'
    'f10g'

[Z,refvec] = 
globedem('d:\externalData\globe\elev',1,latlim,lonlim);
size(Z)

ans =
        325.00        315.00

Tips

The globedem function reads data from GLOBE Version 1.0. The data is for elevations only. Elevations are given in meters above mean sea level using WGS 84 as a horizontal datum. Areas with no data, such as the oceans, are coded with NaNs.

The data set and documentation are available over the Internet.

References

See Web site for the National Oceanic and Atmospheric Administration, National Geophysical Data Center

Version History

Introduced before R2006a

expand all

R2021b: Warns

Raster reading functions that return referencing vectors issue a warning that they will be removed in a future release, including globedem. Instead, use readgeoraster, which returns a geographic raster reference object. Reference objects have several advantages over referencing vectors.

  • Unlike referencing vectors, reference objects have properties that document the size of the associated raster, its geographic limits, and the direction of its rows and columns. For examples of reference object properties, see GeographicCellsReference and GeographicPostingsReference.

  • You can manipulate the limits of rasters associated with reference objects using the geocrop function.

  • You can manipulate the size and resolution of rasters associated with reference objects using the georesize function.

  • Most functions that accept referencing vectors as input also accept reference objects.

This table shows some typical usages of globedem and how to update your code to use readgeoraster instead. Unlike globedem, which requires the .hdr header file to be in the /esri/hdr/ subfolder, the readgeoraster function requires the data file and header file to be in the same folder. The readgeoraster function also requires you to specify a file extension.

Will Be RemovedRecommended
[Z,refvec] = globedem(filename,samplefactor);
[Z,R] = readgeoraster(filename, ...
    'CoordinateSystemType','geographic');
[Z,R] = georesize(Z,R,1/samplefactor);
[Z,refvec] = globedem(filename,samplefactor,latlim,lonlim);
[Z,R] = readgeoraster(filename, ...
    'CoordinateSystemType','geographic');
[Z,R] = geocrop(Z,R,latlim,lonlim);
[Z,R] = georesize(Z,R,1/scalefactor);

The readgeoraster function returns data using the native data type embedded in the file. Return a different data type by specifying the 'OutputType' name-value pair. For example, use [Z,R] = readgeoraster(filename,'OutputType','double').

The readgeoraster function does not automatically replace missing data with NaN values. If your data set uses large negative numbers to indicate missing data, replace them with NaN values using the standardizeMissing function.

[Z,R] = readgeoraster('MtWashington-ft.grd');
info = georasterinfo('MtWashington-ft.grd');
m = info.MissingDataIndicator;
Z = standardizeMissing(Z,m);

Reading and merging multiple GLOBE DEM files from a folder using the readgeoraster function is not supported. To read and merge multiple GLOBE DEM files from a folder:

  1. Find the standard names of the GLOBE DEM files required to cover a region by using the globedems function.

  2. Read the individual files by using the readgeoraster function

  3. Starting in R2024a, merge the files by using the mergetiles function. Before R2024a, merge the files by using the workflow in Merge Spatially Referenced Raster Tiles.

Alternatively, you can read and merge multiple GLOBE DEM files from a folder by using a custom datastore. For more information about using custom datastores to read and merge multiple tiles, see Merge Multiple Raster Tiles Using Datastore.