Documentation Center

  • Trial Software
  • Product Updates

map.rasterref.MapRasterReference class

Package: map.rasterref

Reference raster to map coordinates

Description

A map raster reference object encapsulates the relationship between a planar map coordinate system and a system of intrinsic coordinates anchored to the columns and rows of a 2-D spatially referenced raster grid or image.

Typically, the raster is sampled regularly in the planar world x and world y coordinates of the map system, such that the intrinsic x and world x axes align and the intrinsic y and world y axes align. When this is true, the relationship between the two systems is rectilinear.

More generally, and much more rarely, their relationship is affine. The affine relationship allows for a possible rotation (and skew).

In either case, rectilinear or affine, the sample spacing from row to row need not equal the sample spacing from column to column. If the raster data set is interpreted as comprising a grid of cells or pixels, the cells or pixels need not be square. In the most general case, they could conceivably be parallelograms, but in practice they are always rectangular.

Construction

You can use either of the following functions to construct a map raster reference object:

By default, maprasterref creates a map raster reference object with the raster interpretation of cells (map.rasterref.MapCellsReference). To create a map raster reference object with a raster interpretation of postings (map.rasterref.MapPostingsReference), call maprasterref specifying the rasterInterpretation input argument.

For example, this syntax constructs a MapRasterReference object with default property settings:

R = maprasterref()
R = 

  MapCellsReference with properties:

            XWorldLimits: [0.5 2.5]
            YWorldLimits: [0.5 2.5]
              RasterSize: [2 2]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'south'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 1
      CellExtentInWorldY: 1
    RasterExtentInWorldX: 2
    RasterExtentInWorldY: 2
        XIntrinsicLimits: [0.5 2.5]
        YIntrinsicLimits: [0.5 2.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'

Properties

XWorldLimits

Limits of raster in world x.

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

Default: [0.5000 2.5000]

YWorldLimits

Limits of raster in world y.

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

Default: [0.5000 2.5000]

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 can assign a size vector having more than two elements to RasterSize. This enables assignments like R.RasterSize = size(RGB), where RGB is M-by-N-by-3. In cases like this, only the first two elements of the size vector are stored. Higher (non-spatial) dimensions are ignored. M and N must be positive in all cases and must be 2 or greater when RasterInterpretation is 'postings'.

Default: [2 2]

RasterInterpretation

Defines the geometric nature of the raster and controls the handling of raster edges, among other things.

The value 'cells' indicates that the raster comprises a grid of quadrangular cells, and is bounded on all sides by cell edges. For an M-by-N raster, points with an intrinsic X-coordinate of 1 or N or an intrinsic Y-coordinate of 1 or M fall within the raster, not on its edges.

The value 'postings' indicates that the raster comprises a grid of sample points, where rows or columns of samples run along the edge of the grid. For an M-by-N raster, points with an intrinsic X-coordinate of 1 or N and/or an intrinsic Y-coordinate of 1 or M fall right on an edge (or corner) of the raster.

Cannot be set.

Default: 'cells'

ColumnsStartFrom

Edge where column indexing starts. A string that equals 'south' or 'north'.

Default: 'south'

RowsStartFrom

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

Default: 'west'

CellExtentInWorldX

Supported by map.rasterref.MapCellsReference.

Extent in world X of individual cells. Distance between the eastern and western limits of a single raster cell. The value is always positive, and is the same for all cells in the raster.

Cannot be set.

CellExtentInWorldY

Supported by map.rasterref.MapCellsReference.

Extent in world Y of individual cells. Distance between the northern and southern limits of a single raster cell. The value is always positive, and is the same for all cells in the raster.

Cannot be set.

SampleSpacingInWorldX

Supported by map.rasterref.MapPostingsReference.

Extent in world X of individual cells. Distance between the eastern and western limits of a single raster cell. The value is always positive, and is the same for all cells in the raster.

Cannot be set.

SampleSpacingInWorldY

Supported by map.rasterref.MapPostingsReference.

Extent in world Y of individual cells. Distance between the northern and southern limits of a single raster cell. The value is always positive, and is the same for all cells in the raster.

Cannot be set.

RasterExtentInWorldX

Extent of the full raster or image as measured in the world system in a direction parallel to its rows. In the case of a rectilinear geometry, which is most typical, this is the horizontal direction (east-west).

Cannot be set.

RasterExtentInWorldY

Extent of the full raster or image as measured in the world system in a direction parallel to its columns. In the case of a rectilinear geometry, which is most typical, this is the vertical direction (north-south).

Cannot be set.

XIntrinsicLimits

Raster limits in intrinsic x.

Two-element row vector of the form [xMin xMax]. For an M-by-N raster with RasterInterpretation equal to 'postings', it equals [1 N]. For 'cells', it equals [0.5, N + 0.5].

Cannot be set.

YIntrinsicLimits

Raster limits in intrinsic y

Two-element row vector of the form [yMin yMax]. For an M-by-N raster with RasterInterpretation equal to 'postings', it equals [1 M]. For 'cells', it equals [0.5, M + 0.5].

Cannot be set.

TransformationType

Type of geometric relationship between the intrinsic coordinate system and the world coordinate system. The string has the value 'rectilinear' or 'affine'. Its value is 'rectilinear' when world x depends only on intrinsic x and vice versa, and world y depends only on intrinsic y and vice versa. When the value is 'rectilinear', the image displays without rotation in the world system, although it might be flipped. Otherwise, the value is 'affine'.

Cannot be set.

CoordinateSystemType

Type of coordinate system to which the image or raster is referenced. It is a constant string with value 'planar'.

Cannot be set.

Methods

containsTrue if raster contains points in world coordinate system
firstCornerXWorld x coordinate of the (1,1) corner of the raster
firstCornerYWorld y coordinate of the (1,1) corner of the raster
intrinsicToWorldConvert from intrinsic to world coordinates
sizesMatchTrue if object and raster or image are size compatible
worldFileMatrixWorld file parameters for transformation
worldToDiscreteTransform map to discrete coordinates
worldToIntrinsicConvert from world to intrinsic coordinates

Definitions

Intrinsic Coordinate System

A 2-D Cartesian system with its x-axis running parallel to the rows of a raster or image and its y-axis running parallel to the columns. x increases by 1 from column to column, and y increases by 1 from row to row.

The Mapping Toolbox™ and Image Processing Toolbox™ use the convention for the location of the origin relative to the raster cells or sampling points such that, at a sample location or at the center of a cell, x has an integer value equal to the column index. Likewise, at a sample location or at the center of a cell, y has an integer value equal to the row index. For details, see Image Coordinate Systems in the Image Processing Toolbox documentation.

See Also

| |

Was this topic helpful?