Documentation

maprasterref

Construct map raster reference object

Syntax

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

Description

R = maprasterref() constructs a map raster reference object with default property values.

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

R = maprasterref(W,rasterSize,rasterInterpretation) constructs a map raster reference object with the specified raster size and interpretation properties, and with remaining properties defined by a 2-by-3 world file matrix, W.

Input Arguments

W

2-by-3 world file matrix

rasterSize

Number of cells or samples in each spatial dimension. 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. This argument 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 map raster reference object. Then, you can customize the result by resetting properties from this list one at a time. This name-value syntax always results in an object with a 'rectilinear' TransformationType. If your image is rotated with respect to the world coordinate axes, you need an object with a TransformationType of 'affine'. Alternately, you can provide an appropriate world file matrix as input, as shown in the third syntax. You cannot do it by resetting properties of an existing rectilinear map raster reference object.

'XLimWorld'

Limits of raster in world x

Two-element row vector of the form [xMin xMax].

Default: [0.5 2.5]

'YLimWorld'

Limits of raster in world y

Two-element row vector of the form [yMin yMax].

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'.

Default: 'cells'

'ColumnsStartFrom'

Edge where 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

Map raster reference object

Examples

Construct a referencing object for an 1000-by-2000 image with square, half-meter pixels referenced to a planar map coordinate system (the "world" system). The X-limits in the world system are 207000 and 208000. The Y-limits are 912500 and 913000. The image follows the popular convention in which world X increases from column to column and world Y decreases from row to row.

R = maprasterref('RasterSize', [1000 2000], ...
          'YWorldLimits', [912500 913000], 'ColumnsStartFrom','north', ...
          'XWorldLimits', [207000 208000])
R = 

  MapCellsReference with properties:

            XWorldLimits: [207000 208000]
            YWorldLimits: [912500 913000]
              RasterSize: [1000 2000]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'north'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 1/2
      CellExtentInWorldY: -1/2
    RasterExtentInWorldX: 1000
    RasterExtentInWorldY: 500
        XIntrinsicLimits: [0.5 2000.5]
        YIntrinsicLimits: [0.5 1000.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'

Repeat the first example with a different strategy: Create a default object, and then modify that object's property settings as needed.

R = maprasterref;
R.XWorldLimits = [207000 208000];
R.YWorldLimits = [912500 913000];
R.ColumnsStartFrom = 'north';
R.RasterSize = [1000 2000]
R = 

  MapCellsReference with properties:

            XWorldLimits: [207000 208000]
            YWorldLimits: [912500 913000]
              RasterSize: [1000 2000]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'north'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 1/2
      CellExtentInWorldY: -1/2
    RasterExtentInWorldX: 1000
    RasterExtentInWorldY: 500
        XIntrinsicLimits: [0.5 2000.5]
        YIntrinsicLimits: [0.5 1000.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'

Repeat the first example again, this time using a world file matrix.

W = [0.5   0.0   207000.25; ...
         0.0  -0.5   912999.75];
rasterSize = [1000 2000];
R = maprasterref(W, rasterSize)
R = 

  MapCellsReference with properties:

            XWorldLimits: [207000 208000]
            YWorldLimits: [912500 913000]
              RasterSize: [1000 2000]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'north'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 1/2
      CellExtentInWorldY: -1/2
    RasterExtentInWorldX: 1000
    RasterExtentInWorldY: 500
        XIntrinsicLimits: [0.5 2000.5]
        YIntrinsicLimits: [0.5 1000.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'
Was this topic helpful?