Main Content


Referencing matrix to map raster reference object


R = refmatToMapRasterReference(refmat,rasterSize)
R = refmatToMapRasterReference(___,rasterInterpretation)
R = refmatToMapRasterReference(___,func_name, var_name, arg_pos)
R = refmatToMapRasterReference(Rin,rasterSize, ___)


R = refmatToMapRasterReference(refmat,rasterSize) constructs a map raster reference object, R, from a referencing matrix, refmat, and a size vector, rasterSize.

R = refmatToMapRasterReference(___,rasterInterpretation) uses the rasterInterpretation input to determine which type of map raster reference object to construct. The rasterInterpretation input indicates basic geometric nature of the raster, and can equal either 'cells' or 'postings'.

R = refmatToMapRasterReference(___,func_name, var_name, arg_pos) uses up to three optional arguments to provide additional information. This information is used to construct error messages if either the refmat or rasterSize inputs turn out to be invalid. Thus, you can use refmatToMapRasterReference for both validating and converting a referencing matrix. The optional inputs work just like their counterparts in the function validateattributes.

R = refmatToMapRasterReference(Rin,rasterSize, ___) verifies that Rin.RasterSize is consistent with rasterSize, then copies Rin to R.

Input Arguments


Referencing matrix


Size vector [M N ...] specifying the number of rows (M) and columns (N) in the raster or image to be associated with the MapRasterReference object, R. For convenience, rasterSize may be a row vector with more than two elements. This flexibility allows you to specify the size in the following way:

R = refmatToMapRasterReference(refmat, size(RGB))

where RGB is M-by-N-by-3. However, in such cases, only the first two elements of the size vector are actually used. The higher (non-spatial) dimensions are ignored.


Basic geometric nature of the raster, specified as either 'cells' or 'postings'.


Name used in the formatted error message to identify the function checking the input, specified as a character vector.


Name used in the formatted error message to identify the referencing matrix, specified as a character vector.


Positive integer that indicates the position of the referencing matrix checked in the function argument list. refmatToMapRasterReference includes this information in the formatted error message.


Map raster reference object.

Output Arguments


Map raster reference object.


Convert a referencing matrix manually versus using the maprasterref function.

% Create a sample referencing matrix for a 2000-by-2000
% orthoimage referenced to the Massachusetts State
% Plane Mainland coordinate system.
refmat = [0 -1; 1 0; 208999.5 913000.5];

% Import the corresponding TIFF image and use its size to 
% help convert the referencing matrix to a referencing object.
[X, cmap] = imread('concord_ortho_e.tif');
R = refmatToMapRasterReference(refmat, size(X));

% Obtain the map limits.
xLimWorld = R.XWorldLimits;
yLimWorld = R.YWorldLimits;

% Construct a referencing object directly, for comparison.
R2 = maprasterref('RasterSize',size(X),'ColumnsStartFrom','north', ...

Version History

Introduced in R2011a