setpostn
(Removed) Convert latitude-longitude to data grid rows and columns
The setpostn
function has been removed. Use the geographicToDiscrete
function instead. For more information, see Version History.
Syntax
[row, col] = setpostn(Z, R, lat, lon)
indx = setpostn(...)
[row, col, indxPointOutsideGrid] = setpostn(...)
Description
[row, col] = setpostn(Z, R, lat, lon)
returns the row and column
indices of the regular data grid Z
for the points specified by the
vectors lat
and lon
. R
can be a
geographic raster reference object, a referencing vector, or a referencing matrix.
If R
is a geographic raster reference object, its
RasterSize
property must be consistent with
size(Z)
.
If R
is a referencing vector, it must be 1-by-3 with elements:
[cells/degree northern_latitude_limit western_longitude_limit]
R
is a referencing matrix, it must be 3-by-2 and transform raster row
and column indices to/from geographic coordinates according to:
[lon lat] = [row col 1] * R
R
is a
referencing matrix, it must define a (non-rotational, non-skewed) relationship in which
each column of the data grid falls along a meridian and each row falls along a parallel.
Points falling outside the grid are ignored in row
and
col
. All input angles are in degrees.indx = setpostn(...)
returns the indices of Z
corresponding to the points in lat
and lon
. Points
falling outside the grid are ignored in indx
.
[row, col, indxPointOutsideGrid] = setpostn(...)
returns the
indices of lat
and lon
corresponding to points
outside the grid. These points are ignored in row
and
col
.
Examples
Load elevation raster data and a geographic cells reference object. Then, find the matrix coordinates of Denver, Colorado.
load topo60c
[row,col] = setpostn(topo60c,topo60cR,39.7,105)
row = 130 col = 105