georasterref

Construct geographic raster reference object

Use the georefcells function or the georefpostings function instead, except when constructing a raster reference object from a world file matrix.

Syntax

R = georasterref(W,rasterSize)
R = georasterref(W,rasterSize,rasterInterpretation)
R = georasterref(Name,Value)

Description

R = georasterref(W,rasterSize) creates a reference object for a regular raster of cells in geographic coordinates using the specified world file matrix W and raster size rasterSize.

R = georasterref(W,rasterSize,rasterInterpretation), where rasterInterpretation is 'postings', specifies that the raster contains regularly posted samples in geographic coordinates. The default for rasterInterpretation is 'cells', which specifies a regular raster of cells.

R = georasterref(Name,Value) accepts a list of name-value pairs that are used to assign selected properties when initializing a geographic raster reference object.

Input Arguments

collapse all

World file matrix, specified as a 2-by-3 numeric array. Each of the six elements in W matches one of the lines in a world file that defines the transformation in raster referencing object R.

Data Types: double

Number of rows (m) and columns (n) of the raster or image associated with the referencing object, specified as a two-element vector [m n]. For convenience, you may assign a size vector having more than two elements to RasterSize. This flexibility enables assignments like R.RasterSize = size(RGB), for example, where RGB is m-by-n-by-3. However, in such cases, only the first two elements of the size vector are actually stored. The higher (non-spatial) dimensions are ignored.

Controls handling of raster edges. The rasterInterpretation input is optional, and can equal either 'cells' or 'postings'.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

You can include any of the following properties, overriding their default values as needed. Alternatively, you may omit any or all properties when constructing your geographic raster reference object. Then, you can customize the result by resetting properties from this list one at a time. The exception is the RasterInterpretation property. To have a raster interpretation of 'postings' (rather than the default, 'cells'), the name-value pair 'RasterInterpretation','postings' must be specified in your call to georasterref.

'LatitudeLimits'

Limits in latitude of the geographic quadrangle bounding the georeferenced raster. A two-element vector of the form:

[southern_limit northern_limit]

Default: [0.5 2.5]

'LongitudeLimits'

Limits in longitude of the geographic quadrangle bounding the georeferenced raster. A two-element vector of the form:

[western_limit eastern_limit]

Default: [0.5 2.5]

'RasterSize'

Two-element vector [m n] specifying the number of rows (m) and columns (n) of the raster or image associated with the referencing object. For convenience, you may assign a size vector having more than two elements to RasterSize. This flexibility enables assignments like R.RasterSize = size(RGB), for example, where RGB is m-by-n-by-3. However, in such cases, only the first two elements of the size vector are actually stored. The higher (non-spatial) dimensions are ignored.

Default: [2 2]

'RasterInterpretation'

Controls handling of raster edges, specified as either 'cells' or 'postings'. If you want this property to have other than the default value, you must set it when you create the object. Once created, you cannot change the value of this property in a geographic raster reference object.

Default: 'cells'

'ColumnsStartFrom'

Edge from which column indexing starts, specified as either 'south' or 'north'.

Default: 'south'

'RowsStartFrom'

Edge from which row indexing starts, specified as either 'west' or 'east'.

Default: 'west'

Output Arguments

collapse all

Geographic raster, specified as a GeographicCellsReference or GeographicPostingsReference object.

Examples

Construct a referencing object for a global raster comprising a grid of 180-by-360 one-degree cells, with rows that start at longitude -180, and with the first cell located in the northwest corner.

R = georasterref('RasterSize', [180 360], ...
      'RasterInterpretation', 'cells', 'ColumnsStartFrom', 'north', ...
      'LatitudeLimits', [-90 90], 'LongitudeLimits', [-180 180])

Construct a referencing object for the DTED Level 0 file that includes Sagarmatha (Mount Everest). The DTED columns run from south to north and the first column runs along the western edge of the (one-degree-by-one-degree) quadrangle, consistent with the default values for 'ColumnsStartFrom' and 'RowsStartFrom'.

R = georasterref('LatitudeLimits',[27 28],'LongitudeLimits',[86 87], ...
         'RasterSize', [121 121], 'RasterInterpretation', 'postings')

Repeat the second example with a different strategy: Create an object by specifying only the RasterInterpretation value, then modify the object by resetting additional properties. (As noted above, the RasterInterpretation of an existing raster reference object cannot be changed.)

R = georasterref('RasterInterpretation','postings');
R.RasterSize = [121 121];
R.LatitudeLimits  = [27 28];
R.LongitudeLimits = [86 87];

Repeat the first example using a world file matrix as input.

W = [1    0   -179.5; ...
     0   -1     89.5];
rasterSize = [180 360];
rasterInterpretation = 'cells';
R = georasterref(W, rasterSize, rasterInterpretation);
Introduced in R2011a