Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

maprefcells

Reference raster cells to map coordinates

Syntax

R = maprefcells()
R = maprefcells(xWorldLimits,yWorldLimits,rasterSize)
R = maprefcells(xWorldLimits,yWorldLimits,cellExtentInWorldX,cellExtentInWorldY)
R = maprefcells(xWorldLimits,yWorldLimits,___,Name,Value)

Description

R = maprefcells() returns a default referencing object for a regular raster of cells in planar (map) coordinates.

example

R = maprefcells(xWorldLimits,yWorldLimits,rasterSize) constructs a referencing object for a raster of cells spanning the specified limits in planar coordinates, with the numbers of rows and columns specified by rasterSize.

example

R = maprefcells(xWorldLimits,yWorldLimits,cellExtentInWorldX,cellExtentInWorldY) allows the cell extents to be set precisely. If necessary, maprefcells adjusts the limits of the raster slightly to ensure an integer number of cells in each dimension.

example

R = maprefcells(xWorldLimits,yWorldLimits,___,Name,Value) allows the directions of the columns and rows to be specified via name-value pairs.

Examples

collapse all

Define latitude and longitude limits and dimensions of the image. The image follows the popular convention in which world x coordinates increase from column to column and world y coordinates decrease from row to row.

xWorldLimits = [207000 208000];
yWorldLimits = [912500 913000];
rasterSize = [1000 2000]
rasterSize = 

        1000        2000

Create the referencing object specifying the raster size.

R = maprefcells(xWorldLimits,yWorldLimits,rasterSize,...
    'ColumnsStartFrom','north')
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'


Obtain the same result by specifying the cell extents. For this example, the pixels are 1/2 meter square, referenced to a planar map coordinate system (the "world" system).

extent = 1/2;

R = maprefcells(xWorldLimits,yWorldLimits,extent,extent,...
    'ColumnsStartFrom','north')
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'


Input Arguments

collapse all

Limits in the x direction, specified as a 1-by-2 numeric vector.

Example: xWorldLimits = [207000 208000];

Data Types: double

Limits in the y direction, specified as a 1-by-2 numeric vector.

Example: yWorldLimits = [912500 913000];

Data Types: double

Size of the raster, specified as a 1-by-2 numeric vector.

Example: rasterSize = [180 360];

Data Types: double

Height of cells, specified as a numeric scalar.

Example: extent = 1.5

Data Types: double

Width of cells, specified as a numeric scalar.

Example: extent = 1.5

Data Types: double

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.

Example: R = maprefcells(latlim,lonlim,rasterSize,'ColumnsStartFrom','north')

collapse all

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

Example: R = maprefcells(latlim,lonlim,rasterSize,'ColumnsStartFrom','north')

Data Types: char

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

Example: R = maprefcells(latlim,lonlim,rasterSize,'RowsStartFrom','east')

Data Types: char

Output Arguments

collapse all

Object that references raster cells to map coordinates, returned as a MapCellsReference raster reference object.

Tips

  • To construct a map raster reference object from a world file matrix, use the maprasterref function.

Introduced in R2015b

Was this topic helpful?