Returns the record numbers of cells in a georeferenced grid, according to their XY coordinates.
C = XY2rec ( Header , XY )
Vector of 7 elements describing the grid georeferencing (as returned by GetFloatRasterHeader
or GetFlowDirGridHeader
) : number of columns, number of lines, cellsize, X coordinate of lower-left pixel, Y coordinate of lower-left pixel, NODATA value, convention for positioning the lower-left pixel.
Matrix with n lines and 2 columns containing the coordinates of the points to be projected on the grid.
Output, vector of length size(XY,'r')
: corresponding record numbers in the grid defined by the header.
Returns the record numbers of cells in a georeferenced grid, according to their XY coordinates.
The point with coordinates (x_i,y_i)
is associated with pixel (row_i,col_i)
in the grid, i.e. record rec_i = row_i * ncols + col_i