georasterref
(Not recommended) Create geographic raster reference object
The georasterref
function is not recommended, except when creating a
raster reference object from a world file matrix. To specify options using name-value
arguments, use the georefcells
or georefpostings
function instead. For more information, see Version History.
Syntax
Description
creates a reference object for a raster of quadrangular cells referenced to geographic
coordinates using the world file matrix R
= georasterref(W
,rasterSize
)W
and raster size
rasterSize
.
specifies the geometric nature of the raster. When the raster contains posting point samples
referenced to geographic coordinates, specify R
= georasterref(W
,rasterSize
,rasterInterpretation
)rasterInterpretation
as
"postings"
. The default for rasterInterpretation
is "cells"
, which specifies a raster of quadrangular cells.
specifies options using name-value arguments.R
= georasterref(Name,Value
)
Examples
Create Geographic Reference Object from World File Matrix
Create a reference object for a global raster of cells with size 180-by-360, latitude extents of 1 degree, and longitude extents of 1 degree. Orient the raster using a convention typical for imagery, where image rows run from west to east and image columns run from north to south.
Specify the world file matrix using these values:
Value | Explanation |
---|---|
1 | The rows of the raster start from the west and each cell is one degree in longitude. |
-179.5 | The longitude of the first cell center. |
-1 | The columns of the raster start from the north and each cell is one degree in latitude. |
89.5 | The latitude of the first cell center. |
W = [1 0 -179.5; 0 -1 89.5];
Create the reference object.
R = georasterref(W,[180 360],"cells")
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
W
— World file matrix
2-by-3 numeric array
World file matrix, specified as a 2-by-3 numeric array of the form
[lonspacing 0 lon; 0 latspacing lat]
, where:
lonspacing
determines theRowsStartFrom
and theCellExtentInLongitude
orSampleSpacingInLongitude
properties ofR
.When
lonspacing
is positive,RowsStartFrom
is'west'
. Whenlonspacing
is negative,RowsStartFrom
is'east'
.CellExtentInLongitude
orSampleSpacingInLongitude
isabs(lonspacing)
.
latspacing
determines theColumnsStartFrom
and theCellExtentInLatitude
orSampleSpacingInLatitude
properties ofR
.When
latspacing
is positive,ColumnsStartFrom
is'south'
. Whenlatspacing
is negative,ColumnsStartFrom
is'north'
.CellExtentInLatitude
orSampleSpacingInLatitude
isabs(latspacing)
.
lat
andlon
are the latitude and longitude coordinates of the first cell center or posting point, respectively. For a spatially referenced rasterA
, the first cell center or posting point is the spatial location associated withA(1,1,:)
.The
0
values indicate a rectilinear relationship between the intrinsic and geographic coordinates.
A world file matrix defines a transformation that maps intrinsic coordinates to geographic coordinates.
rasterSize
— Number of rows and columns
two-element vector
Number of rows and columns of 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.
For convenience, you can specify this argument as a vector with more than two
elements, such as the size of an RGB image
(m-by-n-by-3). The
georasterref
function uses only the first two elements of the
size vector.
rasterInterpretation
— Geometric nature of raster
"cells"
(default) | "postings"
Geometric nature of the raster, specified as one of these options:
"cells"
— The raster is a grid of quadrangular cells. The boundary of the raster is made up of the outermost boundaries of the outermost cells."postings"
— The raster is a grid of posting point samples. The boundary of the raster is made up of sampling points along the edge of the raster.
For more information about cells and posting points, see Spatially Reference Imported Rasters.
The corresponding property of the reference object,
RasterInterpretation
, is read-only after you create the
object.
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: georasterref("LatitudeLimits",[-90 90],"LongitudeLimits",[-180
180])
creates a geographic cells reference object with latitudes in the range
[–90, 90] degrees and longitudes in the range [–180, 180] degrees.
LatitudeLimits
— Latitude limits
[0.5 2.5]
(default) | two-element vector
Latitude limits of the geographic quadrangle that bounds the georeferenced raster,
specified as a two-element vector of the form [southern_limit
northern_limit]
.
LongitudeLimits
— Longitude limits
[0.5 2.5]
(default) | two-element vector
Longitude limits of the geographic quadrangle that bounds the georeferenced
raster, specified as a two-element vector of the form [western_limit
eastern_limit]
.
RasterSize
— Number of rows and columns
[2 2]
(default) | two-element vector of positive integers
Number of rows and columns of 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.
For convenience, you can specify RasterSize
as a vector with
more than two elements, such as the size of an RGB image
(m-by-n-by-3). The
georasterref
function uses only the first two elements of the
size vector.
RasterInterpretation
— Geometric nature of raster
"cells"
(default) | "postings"
Geometric nature of the raster, specified as one of these options:
"cells"
— The raster is a grid of quadrangular cells. The boundary of the raster is made up of the outermost boundaries of the outermost cells."postings"
— The raster is a grid of posting point samples. The boundary of the raster is made up of sampling points along the edge of the raster.
For more information about cells and posting points, see Spatially Reference Imported Rasters.
The corresponding property of the raster reference object is read-only after you create the object.
Data Types: char
| string
ColumnsStartFrom
— Edge from which column indexing starts
"south"
(default) | "north"
Edge from which column indexing starts, specified as "south"
or
"north"
.
Data Types: char
| string
RowsStartFrom
— Edge from which row indexing starts
"west"
(default) | "east"
Edge from which row indexing starts, specified as "west"
or
"east"
.
Data Types: char
| string
Output Arguments
R
— Geographic raster reference object
GeographicCellsReference
object | GeographicPostingsReference
object
Geographic raster reference object, returned as a GeographicCellsReference
or GeographicPostingsReference
object. The value of R
depends on the value of the rasterInterpretation
argument or
RasterInterpretation
name-value argument.
rasterInterpretation or
RasterInterpretation | R |
---|---|
"cells" | GeographicCellsReference object |
"postings" | GeographicPostingsReference object |
Version History
Introduced in R2011aR2015b: georasterref
is not recommended
The georasterref
function is not recommended, except when creating
a reference object from a world file matrix. To specify options using name-value arguments,
use the georefcells
or georefpostings
function instead.
Create a reference object for a grid of quadrangular cells referenced to geographic latitude and longitude coordinates by using the
georefcells
function.Create a reference object for a grid of posting point samples referenced to geographic coordinates by using the
georefpostings
function.
See Also
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)