Documentation Center

  • Trial Software
  • Product Updates

georasterref

Construct geographic raster reference object

Syntax

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

Description

R = georasterref() constructs a geographic raster reference object with default property values.

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.

R = georasterref(W,rasterSize,rasterInterpretation) constructs a geographic raster reference object with the specified raster size and interpretation properties, and with remaining properties defined by the world file matrix W. The rasterInterpretation input is optional, can equal either 'cells' or 'postings', and has a default value of 'cells'.

Input Arguments

W

2-by-3 world file matrix

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.

rasterInterpretation

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

Default: 'cells'

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 single 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. A string that equals 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. A string that equals either 'south' or 'north'.

Default: 'south'

'RowsStartFrom'

Edge from which row indexing starts. A string that equals either 'west' or 'east'.

Default: 'west'

Output Arguments

R

Geographic raster reference 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);

See Also

|

Was this topic helpful?