grid2image

Display regular data grid as image

Syntax

grid2image(Z,R)
grid2image(Z,R,'PropertyName',PropertyValue,...)
h = grid2image(...)

Description

grid2image(Z,R) displays a regular data grid Z as an image. The image is displayed in unprojected form, with longitude as x and latitude as y, producing considerable distortion away from the Equator. Z can be M-by-N or M-by-N-by-3, and can contain double, uint8, or uint16 data. The grid is georeferenced to latitude-longitude by R, which can be a geographic raster reference object, a referencing vector, or a referencing matrix.

If R is a geographic raster reference object, its RasterSize property must be consistent with size(Z) and its RasterInterpretation must be 'cells'.

If R is a referencing vector, it must be a 1-by-3 with elements:

[cells/degree northern_latitude_limit western_longitude_limit]

If R is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to/from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define 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.

grid2image(Z,R,'PropertyName',PropertyValue,...) uses the specified image properties to display the map. See the image function reference page for a list of properties that can be changed.

h = grid2image(...) returns the handle of the image object displayed.

Examples

Display a regular data grid as an image.

load topo
R = georasterref('RasterSize', size(topo), ...
   'Latlim', [-90 90], 'Lonlim', [0 360]);
figure; grid2image(topo, R)

Was this topic helpful?