vec2mtx
Convert latitudes and longitudes to raster data grid
Syntax
Description
[
creates a regular raster data grid Z
,R
] = vec2mtx(lat
,lon
,cellsPerDegree
)Z
and geographic raster reference
object R
from the latitudes and longitudes in lat
and lon
, respectively. When a grid cell in Z
corresponds to a location specified by lat
and
lon
, the function sets the grid cell to 1
.
Otherwise, the function sets the grid cell to 0
. Specify the number of
grid cells per degree of latitude and longitude using
cellsPerDegree
.
This function is useful for creating raster data from vector data.
[
where Z
,R
] = vec2mtx(___,"filled")lat
and lon
define one or more closed
polygons, differentiates between cells inside the polygon boundary and outside the polygon
boundary. When a grid cell is inside a polygon boundary, the function sets the grid cell to
0
. When a grid cell is on a polygon boundary, the function sets the
grid cell to 1
. When a grid cell is outside all the polygon boundaries,
the function sets the grid cell to 2
.
Examples
Input Arguments
Output Arguments
Tips
When possible, the
vec2mtx
function includes a buffer of two grid cells on each of the four sides of the grid. The function can include fewer buffer cells to ensure that the latitude limits are in the range of [–90, 90] degrees, and that the difference in longitude limits is less than 360 degrees.