Main Content

georefcells

Reference raster cells to geographic coordinates

Description

R = georefcells() returns a default referencing object for a regular raster of cells in geographic coordinates.

example

R = georefcells(latlim,lonlim,rasterSize) constructs a referencing object for a raster of cells spanning the specified limits in latitude and longitude, with the numbers of rows and columns specified by rasterSize.

example

R = georefcells(latlim,lonlim,latcellextent,loncellextent) allows the geographic cell extents to be set precisely. If necessary, georefcells adjusts the geographic limits slightly to ensure an integer number of cells in each dimension.

example

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

Examples

collapse all

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.

latlim = [-90 90];
lonlim = [-180 180];
rasterSize = [180 360];

Create a raster referencing object by specifying the raster size.

R = georefcells(latlim,lonlim,rasterSize,'ColumnsStartFrom','north')
R = 
  GeographicCellsReference with properties:

             LatitudeLimits: [-90 90]
            LongitudeLimits: [-180 180]
                 RasterSize: [180 360]
       RasterInterpretation: 'cells'
           ColumnsStartFrom: 'north'
              RowsStartFrom: 'west'
       CellExtentInLatitude: 1
      CellExtentInLongitude: 1
     RasterExtentInLatitude: 180
    RasterExtentInLongitude: 360
           XIntrinsicLimits: [0.5 360.5]
           YIntrinsicLimits: [0.5 180.5]
       CoordinateSystemType: 'geographic'
              GeographicCRS: []
                  AngleUnit: 'degree'


Obtain the same result by specifying cell extents.

extent = 1;

R = georefcells(latlim,lonlim,extent,extent,'ColumnsStartFrom','north')
R = 
  GeographicCellsReference with properties:

             LatitudeLimits: [-90 90]
            LongitudeLimits: [-180 180]
                 RasterSize: [180 360]
       RasterInterpretation: 'cells'
           ColumnsStartFrom: 'north'
              RowsStartFrom: 'west'
       CellExtentInLatitude: 1
      CellExtentInLongitude: 1
     RasterExtentInLatitude: 180
    RasterExtentInLongitude: 360
           XIntrinsicLimits: [0.5 360.5]
           YIntrinsicLimits: [0.5 180.5]
       CoordinateSystemType: 'geographic'
              GeographicCRS: []
                  AngleUnit: 'degree'


Input Arguments

collapse all

Latitude limits in degrees, specified as a 1-by-2 numeric vector. The number of rows in the resulting raster is specified by rasterSize.

Example: latlim = [-90 90];

Longitude limits in degrees, specified as a 1-by-2 numeric vector. The number of columns in the resulting raster is specified by rasterSize.

Example: lonlim = [-180 180];

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

Example: rasterSize = [180 360];

Height of cells, specified as a numeric scalar. The value of latcellextent determines the CellExtentInLatitude property of R.

Example: latcellextent = 1.5

Width of cells, specified as a numeric scalar. The value of loncellextent determines the CellExtentInLongitude property of R.

Example: latcellextent = 1.5

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

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

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

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

Data Types: char | string

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

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

Data Types: char | string

Output Arguments

collapse all

Object that references raster cells to geographic coordinates, returned as a GeographicCellsReference raster reference object.

Tips

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

Version History

Introduced in R2015b