주요 콘텐츠

georefcells

R2026b

Reference raster cells to geographic coordinates

Description

R = georefcells(latlim,lonlim,rasterSize) creates a reference object for a regular raster of cells in geographic coordinates. Specify the latitude and longitude limits of the raster using latlim and lonlim. Specify the number of rows and columns in the raster using rasterSize.

example

R = georefcells(latlim,lonlim,latcellextent,loncellextent) specifies the height and width of each cell using latcellextent and loncellextent. If necessary, the georefcells function adjusts the geographic limits to ensure that each dimension of the raster has an integer number of cells.

example

R = georefcells(___,Name=Value) specifies properties of the reference object using one or more name-value arguments, in addition to the input arguments in the previous syntaxes.

example

Examples

collapse all

Create a reference object for a global raster of cells, where the first cell is in the northwest corner. Specify the geographic CRS as the World Geodetic System of 1984, which has the EPSG code 4326.

latlim = [-90 90];
lonlim = [-180 180];
rasterSize = [180 360];
gcrs = geocrs(4326);

R1 = georefcells(latlim,lonlim,rasterSize, ...
    ColumnsStartFrom="north",GeographicCRS=gcrs)
R1 = 
  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: [1×1 geocrs]
                  AngleUnit: 'degree'


Alternatively, specify the cell extents instead of the raster size.

extent = 1;
R2 = georefcells(latlim,lonlim,extent,extent, ...
    ColumnsStartFrom="north",GeographicCRS=gcrs)
R2 = 
  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: [1×1 geocrs]
                  AngleUnit: 'degree'


Input Arguments

collapse all

Latitude limits of the quadrangle that bounds the raster, specified as a two-element vector with elements in the range [–90, 90]. Specify the latitude limits using the form [latmin latmax], where latmax is greater than latmin.

Longitude limits of the quadrangle that bounds the raster, specified as a two-element vector of the form [lonmin lonmax], where lonmax is greater than lonmin.

Number of rows and columns in the raster, specified as a two-element vector of the form [m n], where m is the number of rows and n is the number of columns. This argument sets the RasterSize property of R.

Height of each cell, specified as a positive scalar. This argument sets the CellExtentInLatitude property of R.

Width of each cell, specified as a positive scalar. This argument sets the CellExtentInLongitude property of R.

Name-Value Arguments

collapse all

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.

Example: R = georefcells(latlim,lonlim,rasterSize,ColumnsStartFrom="north") creates a geographic cells reference object with columns that start from north.

Edge from which column indexing starts, specified as one of these options:

  • "south" — Column indexing starts from south.

  • "north" — Column indexing starts from north.

Edge from which row indexing starts, specified as one of these options:

  • "west" — Row indexing starts from west.

  • "east" — Row indexing starts from east.

Geographic coordinate reference system (CRS), specified as a geocrs object.

Output Arguments

collapse all

Geographic cells reference object, returned as a GeographicCellsReference object.

Tips

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

Version History

Introduced in R2015b

expand all