Read GeoTIFF file
[A,R] = geotiffread(filename)
[X,cmap,R] = geotiffread(filename)
[A,refmat,bbox] = geotiffread(filename)
[X,cmap,refmat,bbox] = geotiffread(filename)
[___] = geotiffread(filename,idx)
[___] = geotiffread(url,___)
reads an indexed image into
X, the associated colormap into
cmap, the referencing matrix into
refmat, and the bounding box into
bbox. The referencing matrix must be unambiguously defined by
the GeoTIFF file, otherwise it and the bounding box are returned empty.
[___] = geotiffread(
reads the GeoTIFF image from a URL.
[boston,R] = geotiffread('boston.tif'); figure mapshow(boston,R); axis image off
boston.tif copyright © GeoEye™, all rights reserved.
filename— Name of GeoTIFF file
Name of the GeoTIFF file, specified as a string scalar or character
vector. Include the folder name in
filename or place the
file in the current folder or in a folder on the MATLAB® path. If the named file includes the extension
.TIFF (either upper- or
lowercase), you can omit the extension from
idx— Index of image in GeoTIFF file
1(default) | positive integer
Index of image in GeoTIFF file, specified as a positive integer. For
geotiffread reads the third image in the file. By
idx indexes to the first image in the
url— Internet URL
Internet URL, specified as a string scalar or character vector. The URL must include the protocol type (e.g., "http://").
A— Georeferenced image or data grid
Georeferenced image or data grid, returned as one of the following:
An M-by-N numeric matrix when the file contains a grayscale image or data grid
An M-by-N-by-P numeric array when the file contains a color image, multispectral image, hyperspectral image, or data grid
The class of
A depends on the storage class of the
pixel data in the file, which is related to the
BitsPerSample property as returned by the
R— Spatial referencing object
Spatial referencing object, returned as one of the following.
A geographic raster reference object of type
GeographicPostingsReference. This object is
returned when the image or data grid is referenced to a
geographic coordinate system.
X— Indexed image
Indexed image, returned as an M-by-N numeric matrix.
cmap— Color map
Color map associated with indexed image
as an c-by-3 numeric matrix. There are
c colors in the color map, each represented by a red,
green, and blue pixel value. Colormap values are rescaled into the range
refmat— Referencing matrix
Referencing matrix, returned as 3-by-2 numeric matrix that transforms raster row and column indices to or from geographic coordinates according to:
[lon lat] = [row col 1] * refmat
refmat defines a (non-rotational, non-skewed)
relationship in which each column of the data grid falls along a meridian
and each row falls along a parallel.
refmat must be
unambiguously defined by the GeoTIFF file, otherwise it and the bounding
bbox, are returned empty.
bbox— Bounding box
Bounding box, returned as a 2-by-2 numeric matrix that specifies the
minimum (row 1) and maximum (row 2) values for each dimension of the image
data in the GeoTIFF file.
bbox is returned empty if
refmat is ambiguously defined by the GeoTIFF
geotiffread imports pixel data using the TIFF-reading
capabilities of the MATLAB function
imread and likewise shares any
imread. Consult the
documentation for information on TIFF image support.