refvecToGeoRasterReference

Referencing vector to geographic raster reference object

Syntax

R = refvecToGeoRasterReference(refvec,rasterSize)
R = refvecToGeoRasterReference(___,funcName,varName,argIndex)
R = refvecToGeoRasterReference(Rin,rasterSize,___)

Description

R = refvecToGeoRasterReference(refvec,rasterSize) constructs a geographic raster reference object, R, from a referencing vector, refvec, and a size vector, rasterSize.

R = refvecToGeoRasterReference(___,funcName,varName,argIndex) uses up to three optional arguments to provide additional information. This information is used to construct error messages if either the refvec or rasterSize inputs turn out to be invalid. Thus, you can use refvecToGeoRasterReference for both validating and converting a referencing vector. The optional inputs work just like their counterparts in the MATLAB® function validateattributes.

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

Input Arguments

refvec

Any valid 1-by-3 referencing vector, as long as the cell size 1/refvec(1), northwest corner latitude refvec(2), and northwest corner longitude refvec(3) lead to valid latitude and longitude limits when combined with the rasterSize vector.

rasterSize

Size vector [M N ...] specifying the number of rows (M) and columns (N) in the raster or image to be associated with the GeoRasterReference object, R.

funcName

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

varName

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

argIndex

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

Rin

Geographic raster reference object.

Output Arguments

R

Geographic raster reference object.

Examples

Convert a referencing vector manually versus using the georasterref function.

% Construct a referencing vector for a regular 180-by-240 grid 
% covering an area that includes the Korean Peninsula, with 12 cells 
% per degree.
refvec = [12  45  115];
 
% Convert to a geographic raster reference object:
rasterSize = [180 240];
R = refvecToGeoRasterReference(refvec,rasterSize);
 
% Construct a reference object with the same limits.
latlim = R.LatitudeLimits;
lonlim = R.LongitudeLimits;
R2 = georasterref('RasterSize',rasterSize,'Latlim',latlim, ...
   'Lonlim',lonlim);

See Also

Introduced in R2011a